系列2:C#变量的默认值

2009年4月22日星期三

系列2:C#变量的默认值

The member variables of class types are automatically set to an appropriate default value. This
value will differ based on the exact data type; however, the rules are simple:
• bool types are set to false.
• Numeric data is set to 0 (or 0.0 in the case of floating-point data types).
• string types are set to null.
• char types are set to '\0'.
• Reference types are set to null.


 


Code

 


0 评论:

发表评论