Friday 30 November 2012

Nullable Types in c# 2.0


Nullable types are instances of the System.Nullable struct, which helps value type (int , float etc..) to hold null value. This scenario comes when you are dealing with database and database software support null under value type but not front end language(c#, vb.net). c# 2.0 introduce nullable types to enable value types to hold null value;

Syntax:
            int num1 = null;  // Invalid
             int? num1 = null;  // Valid

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home