What is a nullable Type? How to assign a default value to it? Are nested nullable types allowed?

Wednesday, July 15, 2009


What are nullable types?
Nullable types are those which can represent a null in addition to the normal range of values. It is an instance of System.Nullable.

How to assign a default value to it?
Use the ?? operator to assign a default value when it is assigned to a non-nullable type.
Ex:
int? empid=null;
int tempid= empid ?? 1;

Are nested nullable types allowed?
No.




www.codecollege.NET

0 comments

Post a Comment

LinkWithin

Blog Widget by LinkWithin

Recommended Books