|
||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Tested with Microsoft Visual C# 2005 Beta 1, .Net 2.0.40607.42 Did any of you programmers ever think you'd see the day you could assign null values to value types? Well, you can now! You can now assign the null value to value types by defining nullable types. You do this by adding a question mark to the immediate right of the type name when defining a variable. Nullable types derive from the generic type System.Nullable<T>. Instead of defining types from this generic class, you can simply just use <T>?. Two properties make nullable types quite useful: HasValue and Value. HasValue evaluates to true if the type is not null, otherwise it's false. Value will return the underlying value, whether it's null or not. |
|||||||||||||||||||
|
COPYRIGHT/DISCLAIMER | CONTACT US |
||||||||||||||||||||