How to get the default value of the C# variables?

 Posted by SheoNarayan on 9/6/2011 | Category: C# Interview questions | Views: 6841 | Points: 40
Answer:

To get the default value of the C# variables, default keyword can be used.

        float f = default(float);

Response.Write(f.ToString());

bool b = default(bool);
Response.Write(b.ToString());

DateTime d = default(DateTime);
Response.Write(d.ToString());


Thanks


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response