DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="4.15.2" />

.NET API 592,280 bytes

 EnumConverter

public static class EnumConverter
Provides conversion between enum value and primitive types.
public static TypeCode GetTypeCode<TEnum>() where TEnum : struct, Enum

Gets underlying type of the enum.

public static byte ToByte<T>(this T value) where T : struct, Enum

Converts enum value into primitive type Byte.

public static T ToEnum<T>(this long value) where T : struct, Enum

Converts Int64 into enum of type T.

public static T ToEnum<T>(this int value) where T : struct, Enum

Converts Int32 into enum of type T.

public static T ToEnum<T>(this short value) where T : struct, Enum

Converts Int16 into enum of type T.

public static T ToEnum<T>(this byte value) where T : struct, Enum

Converts Byte into enum of type T.

public static T ToEnum<T>(this sbyte value) where T : struct, Enum

Converts Byte into enum of type T.

public static T ToEnum<T>(this ushort value) where T : struct, Enum

Converts UInt16 into enum of type T.

public static T ToEnum<T>(this uint value) where T : struct, Enum

Converts UInt32 into enum of type T.

public static T ToEnum<T>(this ulong value) where T : struct, Enum

Converts UInt64 into enum of type T.

public static short ToInt16<T>(this T value) where T : struct, Enum

Converts enum value into primitive type Int16.

public static int ToInt32<T>(this T value) where T : struct, Enum

Converts enum value into primitive type Int32.

public static long ToInt64<T>(this T value) where T : struct, Enum

Converts enum value into primitive type Int64.

public static sbyte ToSByte<T>(this T value) where T : struct, Enum

Converts enum value into primitive type SByte.

public static ushort ToUInt16<T>(this T value) where T : struct, Enum

Converts enum value into primitive type UInt16.

public static uint ToUInt32<T>(this T value) where T : struct, Enum

Converts enum value into primitive type UInt32.

public static ulong ToUInt64<T>(this T value) where T : struct, Enum

Converts enum value into primitive type UInt64.