Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

Handle Nullable Types in .Net 2.0.

Author: DevAsp Team
Download Source Code : 700_Nullable types.zip

In this article you will learn how to handle nullable type in 2.0 using c#.

In .net 1.0 work with nullable values is very difficult but in 2.0 this is very simple. This will work for both Data types and data base nullables values.

NameSpace use for this purpose is system.nullable.

here is a simple example

   static void Main(string[] args)

        {

// Declare Nullabe

            int? i;

                        // Assignment

            i = 18;

// Here it Print True because i has value

                        System.Console.WriteLine(i.HasValue);

// Storeing Null In Nullable

                         i = null;             

// Here it Print false because i=null

 System.Console.WriteLine(i.HasValue);           

        }

 

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< Implementing Boxing and Unboxing in .Net 2.0.

Disclaimer - Privacy
© 2002-2017 DevASP.net