Table of Contents

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

value object

Value to convert.

targetType Type

Type to convert to.

Returns

object

Converted value.

Exceptions

InvalidCastException

Occurs when the type conversion between value type and targetType is not supported.

RegisterConverter(Type, Type, IValueConverter)

Registers the type converter using runtime types definitions.

public void RegisterConverter(Type from, Type to, IValueConverter converter)

Parameters

from Type

Source type to convert from.

to Type

Target type to convert to.

converter IValueConverter

The 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

converter IValueConverter<TSource, TTarget>

The converter instance to register.

Type Parameters

TSource

Source type to convert from.

TTarget

Target type to convert to.