July 2007
Intermediate to advanced
224 pages
4h 31m
English
One of the more interesting applications of generics in the .NET Framework is the Nullable<T> class. It is easy to know when a variable of a reference type does or doesn't refer to a valid object. In the latter case, its value is null. But this isn't the case with value types because zero is an entirely valid and reasonable value.
Consider, for example, the case of parsing an XML document, where you have an element defined in the document schema as containing an double. Suppose further that the document schema defines that element as optional; in other words, it may appear either once or not at all. In a .NET wrapper class that complies with the schema, how would you know whether that optional ...
Read now
Unlock full access