What is the use of "Default" keyword in C# ?

 Posted by Akiii on 5/5/2012 | Category: C# Interview questions | Views: 3459 | Points: 40

The default keyword has many usage. One of the uses is it returns a type's default value. For reference types it is "null" and for value types it is "zero".

default(Int32) --- prints 0

default(Boolean) --- prints false
default(String) --- null

Thanks and Regards

| Alert Moderator 

Comments or Responses

Posted by: balajirnaukri-12656 on: 5/12/2012 | Points: 10
Akii I am following a lot of question of yours.It's really good.Thanks for taking a initiative and helping us.
Posted by: Akiii on: 5/12/2012 | Points: 10
Hi Balaji,

Thanks for the encouragement.


Login to post response