How to get the default value of class in C#

29 Apr 2014, 03:30 AM

.Net provides a default(ClassName) method to get the default value of the class. e.g

 var v1 = default(int); // returns 0

 var v2 = default(int?); // returns null

 var v3 = default(Student); // returns null

Related Contents

15 May 2014, 08:07 AM
C#, LINQ, List
15 May 2014, 07:54 AM
C#, LINQ, List
29 Apr 2014, 03:07 AM
C#, Generic
29 Apr 2014, 02:51 AM
C#, Generic
About
Explains how to return the default value of the class in c#.

Date Posted 29 Apr 2014, 03:01 AM
Author Brainy Solutions
Views 817
;