Wednesday, March 28, 2012

Default Values C#

Whenever you create a value type in C#, it always has to have a default value. Following is a quick reference list of what these defaults are, as taken from MSDN.


Value typeDefault value
false
0
'\0'
0.0M
0.0D
The value produced by the expression (E)0, where E is the enum identifier.
0.0F
0
0L
0
0
The value produced by setting all value-type fields to their default values and all reference-type fields to null.
0
0
0

No comments: