Class DynamicEnumerationConverter
- Namespace
- NMF.Models.Dynamic.Serialization
- Assembly
- NMF.Models.Dynamic.dll
Denotes a type converter that dynamically converts strings to enumeration literals and back
public class DynamicEnumerationConverter : TypeConverter
- Inheritance
-
DynamicEnumerationConverter
- Inherited Members
Constructors
DynamicEnumerationConverter(IEnumeration)
Creates a new converter for the given enumeration
public DynamicEnumerationConverter(IEnumeration enumeration)
Parameters
enumerationIEnumerationThe enumeration
Properties
Enumeration
The enumeration for this converter
public IEnumeration Enumeration { get; }
Property Value
Methods
CanConvertFrom(ITypeDescriptorContext, Type)
Returns whether this converter can convert an object of the given type to the type of this converter, using the specified context.
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
Parameters
contextITypeDescriptorContextAn ITypeDescriptorContext that provides a format context.
sourceTypeTypeA Type that represents the type you want to convert from.
Returns
CanConvertTo(ITypeDescriptorContext, Type)
Returns whether this converter can convert the object to the specified type, using the specified context.
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
Parameters
contextITypeDescriptorContextAn ITypeDescriptorContext that provides a format context.
destinationTypeTypeA Type that represents the type you want to convert to.
Returns
ConvertFrom(ITypeDescriptorContext, CultureInfo, object)
Converts the given object to the type of this converter, using the specified context and culture information.
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
Parameters
contextITypeDescriptorContextAn ITypeDescriptorContext that provides a format context.
cultureCultureInfoThe CultureInfo to use as the current culture.
valueobjectThe object to convert.
Returns
Exceptions
- NotSupportedException
The conversion cannot be performed.
ConvertTo(ITypeDescriptorContext, CultureInfo, object, Type)
Converts the given value object to the specified type, using the specified context and culture information.
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
Parameters
contextITypeDescriptorContextAn ITypeDescriptorContext that provides a format context.
cultureCultureInfoA CultureInfo. If null is passed, the current culture is assumed.
valueobjectThe object to convert.
destinationTypeTypeThe Type to convert the
valueparameter to.
Returns
Exceptions
- ArgumentNullException
The
destinationTypeparameter is null.- NotSupportedException
The conversion cannot be performed.