I spent part of today scratching my head and dredging up long-forgotten details of the .Net Framework and C# over at BrainBench.com – to my relief, I didn’t disgrace myself: a test score average of 4.25 puts me in good stead for my forthcoming MCP exam later in June.
Some of the tricky areas:
- C# strings live in the
- Structs vs. Classes – particularly with reference to how Structs get auto-boxed when casting to an interface
- The difference between readonly variables and constants – illustrated by the ilasm generated
- A Remoting refresher – the issue of Remoting and GC is particularly non-obvious
- Some info on valid Type Conversions – crucially, casting anything to a
charis invalid, which gets over some naaasty C-style hacks
- Items that can be serialized by XmlSerializer:
- The following items can be serialized using the XmLSerializer class.
- Public read/write properties and fields of public classes.
- Classes that implement ICollection or IEnumerable. (Note that only collections are serialized, not public properties.)
- XmlElement objects.
- XmlNode objects.
- DataSet objects.
- Forcing the compiler to check for CLS-compliancy –
- A whole bunch of stuff on Code Access Security – though the basic idea is quite simple: establish security requirements at compile time, and DEMAND that running code has those permissions before allowing execution (as opposed to running as far as possible with the current credentials/rights)
- Dynamic Methods and Assemblies – use types in
- Some details on XSD.exe: workarounds, and an improved version – I discovered that even then VS2005 version of XSD.exe has some serious bugs, such as eating memory when presented with a multi-table SP-based dataset.
- Finally (as it were) we have Non-deterministic finalization, and destructors/
Dispose()– often safely ignored in simpler code, but can lead to Bad Things if abused in enterprise applications