Show / Hide Table of Contents

Class EnumConverter

Provides conversion between enum value and primitive types.

Inheritance
Object
EnumConverter
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: DotNext
Assembly: DotNext.dll
Syntax
public static class EnumConverter

Methods

| Improve this Doc View Source

IsOneOf<T>(T, T[])

Checks whether the specified value is equal to one of the specified values.

Declaration
public static bool IsOneOf<T>(this T value, params T[] values)

    where T : struct, Enum
Parameters
Type Name Description
T value

The value to compare with other.

T[] values

Candidate objects.

Returns
Type Description
Boolean

true, if value is equal to one of values.

Type Parameters
Name Description
T

The type of object to compare.

| Improve this Doc View Source

ToByte<T>(T)

Converts enum value into primitive type Byte.

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 Byte.

Type Parameters
Name Description
T

Type of the enum value to be converted.

| Improve this Doc View Source

ToEnum<T>(Byte)

Converts Byte into enum of type 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 Byte value.

Type Parameters
Name Description
T

The target enum type.

| Improve this Doc View Source

ToEnum<T>(Int16)

Converts Int16 into enum of type 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 Int16 value.

Type Parameters
Name Description
T

The target enum type.

| Improve this Doc View Source

ToEnum<T>(Int32)

Converts Int32 into enum of type 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 Int32 value.

Type Parameters
Name Description
T

The target enum type.

| Improve this Doc View Source

ToEnum<T>(Int64)

Converts Int64 into enum of type 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 Int64 value.

Type Parameters
Name Description
T

The target enum type.

| Improve this Doc View Source

ToEnum<T>(SByte)

Converts Byte into enum of type T.

Declaration
[CLSCompliant(false)]
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 Byte value.

Type Parameters
Name Description
T

The target enum type.

| Improve this Doc View Source

ToEnum<T>(UInt16)

Converts UInt16 into enum of type T.

Declaration
[CLSCompliant(false)]
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 UInt16 value.

Type Parameters
Name Description
T

The target enum type.

| Improve this Doc View Source

ToEnum<T>(UInt32)

Converts UInt32 into enum of type T.

Declaration
[CLSCompliant(false)]
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 UInt32 value.

Type Parameters
Name Description
T

The target enum type.

| Improve this Doc View Source

ToEnum<T>(UInt64)

Converts UInt64 into enum of type T.

Declaration
[CLSCompliant(false)]
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 UInt64 value.

Type Parameters
Name Description
T

The target enum type.

| Improve this Doc View Source

ToInt16<T>(T)

Converts enum value into primitive type Int16.

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 Int16.

Type Parameters
Name Description
T

Type of the enum value to be converted.

| Improve this Doc View Source

ToInt32<T>(T)

Converts enum value into primitive type Int32.

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 Int32.

Type Parameters
Name Description
T

Type of the enum value to be converted.

| Improve this Doc View Source

ToInt64<T>(T)

Converts enum value into primitive type Int64.

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 Int64.

Type Parameters
Name Description
T

Type of the enum value to be converted.

| Improve this Doc View Source

ToSByte<T>(T)

Converts enum value into primitive type SByte.

Declaration
[CLSCompliant(false)]
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 SByte.

Type Parameters
Name Description
T

Type of the enum value to be converted.

| Improve this Doc View Source

ToUInt16<T>(T)

Converts enum value into primitive type UInt16.

Declaration
[CLSCompliant(false)]
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 UInt16.

Type Parameters
Name Description
T

Type of the enum value to be converted.

| Improve this Doc View Source

ToUInt32<T>(T)

Converts enum value into primitive type UInt32.

Declaration
[CLSCompliant(false)]
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 UInt32.

Type Parameters
Name Description
T

Type of the enum value to be converted.

| Improve this Doc View Source

ToUInt64<T>(T)

Converts enum value into primitive type UInt64.

Declaration
[CLSCompliant(false)]
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 UInt64.

Type Parameters
Name Description
T

Type of the enum value to be converted.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX