Table of Contents

Class EnumXmlConverter<T>

Namespace
NanoByte.Common.Values.Design
Assembly
NanoByte.Common.dll

Type converter for Enums annotated with XmlEnumAttributes.

public class EnumXmlConverter<T> : TypeConverter where T : struct, Enum

Type Parameters

T

The type the converter is used for.

Inheritance
object
EnumXmlConverter<T>
Inherited Members
Extension Methods

Examples

Add this attribute to the Enum:

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

Remarks

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

Constructors

EnumXmlConverter()

public EnumXmlConverter()

Methods

CanConvertFrom(ITypeDescriptorContext?, Type)

public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)

Parameters

context ITypeDescriptorContext
sourceType Type

Returns

bool

ConvertFrom(ITypeDescriptorContext?, CultureInfo?, object)

public override object ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value)

Parameters

context ITypeDescriptorContext
culture CultureInfo
value object

Returns

object

ConvertTo(ITypeDescriptorContext?, CultureInfo?, object?, Type)

public override object ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)

Parameters

context ITypeDescriptorContext
culture CultureInfo
value object
destinationType Type

Returns

object

GetStandardValues(ITypeDescriptorContext?)

public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext? context)

Parameters

context ITypeDescriptorContext

Returns

TypeConverter.StandardValuesCollection

GetStandardValuesExclusive(ITypeDescriptorContext?)

public override bool GetStandardValuesExclusive(ITypeDescriptorContext? context)

Parameters

context ITypeDescriptorContext

Returns

bool

GetStandardValuesSupported(ITypeDescriptorContext?)

public override bool GetStandardValuesSupported(ITypeDescriptorContext? context)

Parameters

context ITypeDescriptorContext

Returns

bool