C# Class EnumDescriptionConverter, gert

EnumConverter supporting System.ComponentModel.DescriptionAttribute
Inheritance: System.ComponentModel.EnumConverter
显示文件 Open project: mono/gert Class Usage Examples

Public Methods

Method Description
ConvertFrom ( ITypeDescriptorContext context, CultureInfo culture, object value ) : object

Converts the given object to the type of this converter, using the specified context and culture information.

This member overrides TypeConverter.ConvertFrom(ITypeDescriptorContext, CultureInfo, object).

ConvertTo ( ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType ) : object

Converts the given value object to the specified type, using the specified context and culture information.

This member overrides TypeConverter.ConvertTo(ITypeDescriptorContext, CultureInfo, object, Type).

EnumDescriptionConverter ( System type ) : System

Constructs EnumDescriptionConverter for a given Enum

GetEnumDescription ( Enum value ) : string

Gets the Description of the given Enumeration value

GetEnumDescription ( System value, string name ) : string

Gets the Description of a named value in an Enumeration

GetEnumValue ( System value, string description ) : object

Gets the value of an Enum, based on it's Description Attribute or named value

Method Details

ConvertFrom() public method

Converts the given object to the type of this converter, using the specified context and culture information.

This member overrides TypeConverter.ConvertFrom(ITypeDescriptorContext, CultureInfo, object).

public ConvertFrom ( ITypeDescriptorContext context, CultureInfo culture, object value ) : object
context ITypeDescriptorContext An that provides a format context.
culture CultureInfo A object. If a is passed, the current culture is assumed.
value object The to convert.
return object

ConvertTo() public method

Converts the given value object to the specified type, using the specified context and culture information.

This member overrides TypeConverter.ConvertTo(ITypeDescriptorContext, CultureInfo, object, Type).

public ConvertTo ( ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType ) : object
context ITypeDescriptorContext An that provides a format context.
culture CultureInfo A object. If a is passed, the current culture is assumed.
value object The to convert.
destinationType Type The to convert the parameter to.
return object

EnumDescriptionConverter() public method

Constructs EnumDescriptionConverter for a given Enum
public EnumDescriptionConverter ( System type ) : System
type System
return System

GetEnumDescription() public static method

Gets the Description of the given Enumeration value
public static GetEnumDescription ( Enum value ) : string
value Enum The enumeration value
return string

GetEnumDescription() public static method

Gets the Description of a named value in an Enumeration
public static GetEnumDescription ( System value, string name ) : string
value System The type of the Enumeration
name string The name of the Enumeration value
return string

GetEnumValue() public static method

Gets the value of an Enum, based on it's Description Attribute or named value
public static GetEnumValue ( System value, string description ) : object
value System The Enum type
description string The description or name of the element
return object