C# Класс EnumDescriptionConverter, gert

EnumConverter supporting System.ComponentModel.DescriptionAttribute
Наследование: System.ComponentModel.EnumConverter
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Описание методов

ConvertFrom() публичный Метод

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.
Результат object

ConvertTo() публичный Метод

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.
Результат object

EnumDescriptionConverter() публичный Метод

Constructs EnumDescriptionConverter for a given Enum
public EnumDescriptionConverter ( System type ) : System
type System
Результат System

GetEnumDescription() публичный статический Метод

Gets the Description of the given Enumeration value
public static GetEnumDescription ( Enum value ) : string
value Enum The enumeration value
Результат string

GetEnumDescription() публичный статический Метод

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
Результат string

GetEnumValue() публичный статический Метод

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
Результат object