2014年3月20日

【转载】#470 Define Your Own Custom Attribute

摘要: You can use predefined attributes to attach metadata to type members.You can also define a custom attribute by creating a new class inheriting from System.Attribute. The class name must end in "Attribute". You typically define a conostructor that takes arguments that consist of the metadat 阅读全文

posted @ 2014-03-20 21:31 yuthreestone 阅读(256) 评论(0) 推荐(0) 编辑

【转载】#458 Errors While Converting Between enum and Underlying Type

摘要: You can convert to an enum value from its underlying type by casting the underlying type (e.g. int) to the enum type.However, when you cast a value that doesn't have a corresponding enumerator in the type, you don't get any sort of error.In the example below,the Mood type has enumerators tha 阅读全文

posted @ 2014-03-20 20:36 yuthreestone 阅读(211) 评论(0) 推荐(0) 编辑

【转载】#457 Converting Between enums and their Underlying Type

摘要: When you declare an enum, by default each enumerated value is represented internally with an int. (System.Int32 - 4 bytes). You can convert between values of the underlying type and enum values using an explicit cast. Because an enum is represented by an int by default, you can convert between integ 阅读全文

posted @ 2014-03-20 20:20 yuthreestone 阅读(198) 评论(0) 推荐(0) 编辑

导航