New to Telerik UI for .NET MAUIStart a free 30-day trial

Provides a base class for registering and managing type conversions between source and target types.

Definition

Namespace:Telerik.Maui.Controls.Compatibility.Common

Assembly:Telerik.Maui.Controls.Compatibility.dll

Type Parameters:

P

The target platform type for conversions.

Syntax:

C#
public abstract class TypeRegister<P>

Inheritance: objectTypeRegister<P>

Derived Classes: TypeRegister

Constructors

Initializes a new instance of the TypeRegister<P> class.

C#
protected TypeRegister()

Methods

When overridden in a derived class, gets the platform-specific representation of the object.

C#
protected abstract P GetNativeObjectCore(object value)
Parameters:valueobject

The object to convert.

Returns:

P

The platform-specific representation.

When overridden in a derived class, gets the platform-specific type for the specified type.

C#
protected abstract Type GetNativeTypeCore(Type type)
Parameters:typeType

The source type.

Returns:

Type

The platform-specific type.

When overridden in a derived class, gets the object representation from the platform-specific value.

C#
protected abstract object GetObjectCore(P value, Type clrType, object context)
Parameters:valueP

The platform-specific value to convert.

clrTypeType

The CLR type to convert to.

contextobject

The conversion context.

Returns:

object

The converted object.

When overridden in a derived class, gets a type converter for the specified types.

C#
protected abstract ITypeConverter<P> GetTypeConverter(Type type, Type nativeType)
Parameters:typeType

The source type.

nativeTypeType

The target native type.

Returns:

ITypeConverter<P>

A type converter for the specified types.

Registers a type converter for the specified source and target types.

C#
public static void Register(Type sourceType, Type targetType, ITypeConverter<P> converter)
Parameters:sourceTypeType

The source type to convert from.

targetTypeType

The target type to convert to.

converterITypeConverter<P>

The type converter to use for the conversion.

Registers a type converter for the specified generic source and target types.

C#
public static void Register<O, N>() where N : P