Generic Code

default keyword in c#

The “Default” keyword in c# can be used in the following scenarios .

The main use of default comes in to picture when used in the generic code.

1. To return Type’s Default Value

The Default returns the type’s default value.

For the Integer , it returns 0 , for Boolean , it returns false and for the reference types , it returns null

int valueI = default(Int32);bool ValueB = default(Boolean);string senthil

read more