Ray's playground

 

Item 19: Ensure That 0 Is a Valid State for Value Types(Effective C#)

  The system initializes all instances of value types to 0. There is no way to prevent users from creating instances of value types that are all 0s. If possible, make the all 0 case the natural default. As a special case, enums used as flags should ensure that 0 is the absence of all flags.

posted on 2011-02-09 21:22  Ray Z  阅读(125)  评论(0编辑  收藏  举报

导航