Class TypeConversion
Helper class to handle type conversion during properties API calls.
Namespace: Unity.Properties
Syntax
public static class TypeConversion : object
Methods
Convert<TSource, TDestination>(TSource)
Converts the specified value from TSource to TDestination.
Declaration
public static TDestination Convert<TSource, TDestination>(TSource value)
Parameters
| Type | Name | Description |
|---|---|---|
| TSource | value | The source value to convert. |
Returns
| Type | Description |
|---|---|
| TDestination | The value converted to the |
Type Parameters
| Name | Description |
|---|---|
| TSource | The source type to convert from. |
| TDestination | The destination type to convert to. |
Convert<TSource, TDestination>(ref TSource)
Converts the specified value from TSource to TDestination.
Declaration
public static TDestination Convert<TSource, TDestination>(ref TSource value)
Parameters
| Type | Name | Description |
|---|---|---|
| TSource | value | The source value to convert. |
Returns
| Type | Description |
|---|---|
| TDestination | The value converted to the |
Type Parameters
| Name | Description |
|---|---|
| TSource | The source type to convert from. |
| TDestination | The destination type to convert to. |
Register<TSource, TDestination>(ConvertDelegate<TSource, TDestination>)
Registers a new converter from TSource to TDestination.
Declaration
public static void Register<TSource, TDestination>(ConvertDelegate<TSource, TDestination> converter)
Parameters
| Type | Name | Description |
|---|---|---|
| ConvertDelegate<TSource, TDestination> | converter |
Type Parameters
| Name | Description |
|---|---|
| TSource | |
| TDestination |
TryConvert<TSource, TDestination>(TSource, out TDestination)
Converts the specified value from TSource to TDestination.
Declaration
public static bool TryConvert<TSource, TDestination>(TSource source, out TDestination destination)
Parameters
| Type | Name | Description |
|---|---|---|
| TSource | source | The source value to convert. |
| TDestination | destination | When this method returns, contains the converted destination value if the conversion succeeded; otherwise, default. |
Returns
| Type | Description |
|---|---|
| Boolean |
Type Parameters
| Name | Description |
|---|---|
| TSource | The source type to convert from. |
| TDestination | The destination type to convert to. |
TryConvert<TSource, TDestination>(ref TSource, out TDestination)
Converts the specified value from TSource to TDestination.
Declaration
public static bool TryConvert<TSource, TDestination>(ref TSource source, out TDestination destination)
Parameters
| Type | Name | Description |
|---|---|---|
| TSource | source | The source value to convert. |
| TDestination | destination | When this method returns, contains the converted destination value if the conversion succeeded; otherwise, default. |
Returns
| Type | Description |
|---|---|
| Boolean |
Type Parameters
| Name | Description |
|---|---|
| TSource | The source type to convert from. |
| TDestination | The destination type to convert to. |