Class TypeConversionManager
- Namespace
- Icy.Data
- Assembly
- IcyUI.dll
Represents a unified type conversion helper.
public class TypeConversionManager : ITypeConverter
- Inheritance
-
TypeConversionManager
- Implements
- Inherited Members
- Extension Methods
Methods
Convert(object?, Type)
Converts specified value to the specified target type.
public object? Convert(object? value, Type targetType)
Parameters
Returns
- object
Converted value.
Exceptions
- InvalidCastException
Occurs when the type conversion between
valuetype andtargetTypeis not supported.
RegisterConverter(Type, Type, IValueConverter)
Registers the type converter using runtime types definitions.
public void RegisterConverter(Type from, Type to, IValueConverter converter)
Parameters
fromTypeSource type to convert from.
toTypeTarget type to convert to.
converterIValueConverterThe converter instance to register.
RegisterConverter<TSource, TTarget>(IValueConverter<TSource, TTarget>)
Registers the custom type converter to handle custom types conversion.
public void RegisterConverter<TSource, TTarget>(IValueConverter<TSource, TTarget> converter)
Parameters
converterIValueConverter<TSource, TTarget>The converter instance to register.
Type Parameters
TSourceSource type to convert from.
TTargetTarget type to convert to.