Class TypeConversionInstance
Type conversion instance. Use to define own conversion flow on the instance level.
If you would like to define global conversion see the TypeConversion
Inheritance
Inherited Members
Namespace: StansAssets.Foundation
Assembly: cs.temp.dll.dll
Syntax
public class TypeConversionInstance
Methods
Convert<TSource, TDestination>(TSource)
Converts given the value to the destination type
@NOTE Fastest conversion method
Declaration
public TDestination Convert<TSource, TDestination>(TSource value)
Parameters
Type | Name | Description |
---|---|---|
TSource | value | Value to convert to. |
Returns
Type | Description |
---|---|
TDestination | Converted value. |
Type Parameters
Name | Description |
---|---|
TSource | Source type. |
TDestination | Conversion Destination type. |
HasConvertor(Type, Type)
Methods is used to check of convertor is registered for a specified types pare.
Declaration
public bool HasConvertor(Type source, Type destination)
Parameters
Type | Name | Description |
---|---|---|
System.Type | source | Source type. |
System.Type | destination | Conversion Destination type. |
Returns
Type | Description |
---|---|
System.Boolean | Returns |
HasConvertor<TSource, TDestination>()
Methods is used to check of convertor is registered for a specified types pare.
Declaration
public bool HasConvertor<TSource, TDestination>()
Returns
Type | Description |
---|---|
System.Boolean | Returns |
Type Parameters
Name | Description |
---|---|
TSource | Source type. |
TDestination | Conversion Destination type. |
Register<TSource, TDestination>(Func<TSource, TDestination>)
Registers a new type conversion from the given source type to the given destination type.
Declaration
public void Register<TSource, TDestination>(Func<TSource, TDestination> conversion)
Parameters
Type | Name | Description |
---|---|---|
System.Func<TSource, TDestination> | conversion | Conversion delegate method. |
Type Parameters
Name | Description |
---|---|
TSource | Input type. |
TDestination | Output type. |