NanoByte.Common
Public Member Functions | List of all members
NanoByte.Common.Values.Design.EnumDescriptionConverter< T > Class Template Reference

Type converter for Enums annotated with DescriptionAttributes. More...

Inheritance diagram for NanoByte.Common.Values.Design.EnumDescriptionConverter< T >:

Public Member Functions

override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
 
override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
 
override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 

Detailed Description

Type converter for Enums annotated with DescriptionAttributes.

Template Parameters
TThe type the converter is used for.

Add this attribute to the Enum:

[TypeConverter(typeof(DescriptionEnumConverter<NameOfEnum>))]

DescriptionAttribute.Description is used as the case-insensitive string representation (falls back to element name).

Type Constraints
T :struct 

The documentation for this class was generated from the following file: