Class EnumConverter
Provides conversion between enum value and primitive types.
Namespace: DotNext
Assembly: DotNext.dll
Syntax
public static class EnumConverter : object
Methods
| Improve this Doc View SourceToByte<T>(T)
Converts enum value into primitive type
Declaration
public static byte ToByte<T>(this T value)
where T : struct, Enum
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | Enum value to be converted. |
Returns
| Type | Description |
|---|---|
| Byte | Enum value represented as |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the enum value to be converted. |
ToEnum<T>(Byte)
Converts T.
Declaration
public static T ToEnum<T>(this byte value)
where T : struct, Enum
Parameters
| Type | Name | Description |
|---|---|---|
| Byte | value | The value to be converted. |
Returns
| Type | Description |
|---|---|
| T | Enum value equals to the given |
Type Parameters
| Name | Description |
|---|---|
| T | The target enum type. |
ToEnum<T>(Int16)
Converts T.
Declaration
public static T ToEnum<T>(this short value)
where T : struct, Enum
Parameters
| Type | Name | Description |
|---|---|---|
| Int16 | value | The value to be converted. |
Returns
| Type | Description |
|---|---|
| T | Enum value equals to the given |
Type Parameters
| Name | Description |
|---|---|
| T | The target enum type. |
ToEnum<T>(Int32)
Converts T.
Declaration
public static T ToEnum<T>(this int value)
where T : struct, Enum
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | value | The value to be converted. |
Returns
| Type | Description |
|---|---|
| T | Enum value equals to the given |
Type Parameters
| Name | Description |
|---|---|
| T | The target enum type. |
ToEnum<T>(Int64)
Converts T.
Declaration
public static T ToEnum<T>(this long value)
where T : struct, Enum
Parameters
| Type | Name | Description |
|---|---|---|
| Int64 | value | The value to be converted. |
Returns
| Type | Description |
|---|---|
| T | Enum value equals to the given |
Type Parameters
| Name | Description |
|---|---|
| T | The target enum type. |
ToEnum<T>(SByte)
Converts T.
Declaration
public static T ToEnum<T>(this sbyte value)
where T : struct, Enum
Parameters
| Type | Name | Description |
|---|---|---|
| SByte | value | The value to be converted. |
Returns
| Type | Description |
|---|---|
| T | Enum value equals to the given |
Type Parameters
| Name | Description |
|---|---|
| T | The target enum type. |
ToEnum<T>(UInt16)
Converts T.
Declaration
public static T ToEnum<T>(this ushort value)
where T : struct, Enum
Parameters
| Type | Name | Description |
|---|---|---|
| UInt16 | value | The value to be converted. |
Returns
| Type | Description |
|---|---|
| T | Enum value equals to the given |
Type Parameters
| Name | Description |
|---|---|
| T | The target enum type. |
ToEnum<T>(UInt32)
Converts T.
Declaration
public static T ToEnum<T>(this uint value)
where T : struct, Enum
Parameters
| Type | Name | Description |
|---|---|---|
| UInt32 | value | The value to be converted. |
Returns
| Type | Description |
|---|---|
| T | Enum value equals to the given |
Type Parameters
| Name | Description |
|---|---|
| T | The target enum type. |
ToEnum<T>(UInt64)
Converts T.
Declaration
public static T ToEnum<T>(this ulong value)
where T : struct, Enum
Parameters
| Type | Name | Description |
|---|---|---|
| UInt64 | value | The value to be converted. |
Returns
| Type | Description |
|---|---|
| T | Enum value equals to the given |
Type Parameters
| Name | Description |
|---|---|
| T | The target enum type. |
ToInt16<T>(T)
Converts enum value into primitive type
Declaration
public static short ToInt16<T>(this T value)
where T : struct, Enum
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | Enum value to be converted. |
Returns
| Type | Description |
|---|---|
| Int16 | Enum value represented as |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the enum value to be converted. |
ToInt32<T>(T)
Converts enum value into primitive type
Declaration
public static int ToInt32<T>(this T value)
where T : struct, Enum
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | Enum value to be converted. |
Returns
| Type | Description |
|---|---|
| Int32 | Enum value represented as |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the enum value to be converted. |
ToInt64<T>(T)
Converts enum value into primitive type
Declaration
public static long ToInt64<T>(this T value)
where T : struct, Enum
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | Enum value to be converted. |
Returns
| Type | Description |
|---|---|
| Int64 | Enum value represented as |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the enum value to be converted. |
ToSByte<T>(T)
Converts enum value into primitive type
Declaration
public static sbyte ToSByte<T>(this T value)
where T : struct, Enum
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | Enum value to be converted. |
Returns
| Type | Description |
|---|---|
| SByte | Enum value represented as |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the enum value to be converted. |
ToUInt16<T>(T)
Converts enum value into primitive type
Declaration
public static ushort ToUInt16<T>(this T value)
where T : struct, Enum
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | Enum value to be converted. |
Returns
| Type | Description |
|---|---|
| UInt16 | Enum value represented as |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the enum value to be converted. |
ToUInt32<T>(T)
Converts enum value into primitive type
Declaration
public static uint ToUInt32<T>(this T value)
where T : struct, Enum
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | Enum value to be converted. |
Returns
| Type | Description |
|---|---|
| UInt32 | Enum value represented as |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the enum value to be converted. |
ToUInt64<T>(T)
Converts enum value into primitive type
Declaration
public static ulong ToUInt64<T>(this T value)
where T : struct, Enum
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | Enum value to be converted. |
Returns
| Type | Description |
|---|---|
| UInt64 | Enum value represented as |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the enum value to be converted. |