Show / Hide Table of Contents

Struct Enum<E>

Provides strongly typed way to reflect enum type.

Implements
IEquatable<E>
IComparable<E>
IFormattable
IEquatable<Enum<E>>
ISerializable
Namespace: DotNext
Assembly: DotNext.dll
Syntax
public struct Enum<E> : IEquatable<E>, IComparable<E>, IFormattable, IEquatable<Enum<E>>, ISerializable where E : struct, Enum
Type Parameters
Name Description
E

Enum type to reflect.

Fields

| Improve this Doc View Source

MaxValue

Maximum enum value.

Declaration
public static readonly Enum<E> MaxValue
Field Value
Type Description
Enum<E>
| Improve this Doc View Source

MinValue

Minimum enum value.

Declaration
public static readonly Enum<E> MinValue
Field Value
Type Description
Enum<E>

Properties

| Improve this Doc View Source

Members

Gets declared enum members.

Declaration
public static IReadOnlyList<Enum<E>> Members { get; }
Property Value
Type Description
IReadOnlyList<Enum<E>>
| Improve this Doc View Source

Name

Represents name of the enum member.

Declaration
public string Name { get; }
Property Value
Type Description
String
| Improve this Doc View Source

UnderlyingType

Gets the underlying type of the specified enumeration.

Declaration
public static Type UnderlyingType { get; }
Property Value
Type Description
Type
| Improve this Doc View Source

UnderlyingTypeCode

Gets code of the underlying primitive type.

Declaration
public static TypeCode UnderlyingTypeCode { get; }
Property Value
Type Description
TypeCode
| Improve this Doc View Source

Value

Represents value of the enum member.

Declaration
public E Value { get; }
Property Value
Type Description
E

Methods

| Improve this Doc View Source

CompareTo(E)

Compares this enum value with other.

Declaration
public int CompareTo(E other)
Parameters
Type Name Description
E other

Other value to compare.

Returns
Type Description
Int32

Comparison result.

| Improve this Doc View Source

Equals(E)

Determines whether this value equals to the other enum value.

Declaration
public bool Equals(E other)
Parameters
Type Name Description
E other

Other value to compare.

Returns
Type Description
Boolean

Equality check result.

| Improve this Doc View Source

Equals(Enum<E>)

Determines whether two enum members are equal.

Declaration
public bool Equals(Enum<E> other)
Parameters
Type Name Description
Enum<E> other

Other member to compare.

Returns
Type Description
Boolean

true if this enum member is the same as other; otherwise, false.

| Improve this Doc View Source

Equals(Object)

Determines whether this value equals to the other enum value.

Declaration
public override bool Equals(object other)
Parameters
Type Name Description
Object other

Other value to compare.

Returns
Type Description
Boolean

Equality check result.

| Improve this Doc View Source

GetHashCode()

Gets hash code of the enum member.

Declaration
public override int GetHashCode()
Returns
Type Description
Int32

The hash code of the enum member.

| Improve this Doc View Source

GetMember(E)

Gets enum member by its value.

Declaration
public static Enum<E> GetMember(E value)
Parameters
Type Name Description
E value

The enum value.

Returns
Type Description
Enum<E>

The enum member.

| Improve this Doc View Source

GetMember(String)

Gets enum member by its case-sensitive name.

Declaration
public static Enum<E> GetMember(string name)
Parameters
Type Name Description
String name

The name of the enum value.

Returns
Type Description
Enum<E>

The enum member.

| Improve this Doc View Source

HasFlag(E)

Determines whether one or more bit fields are set in the current instance.

Declaration
public bool HasFlag(E flag)
Parameters
Type Name Description
E flag

An enumeration value.

Returns
Type Description
Boolean
| Improve this Doc View Source

IsDefined(E)

Returns an indication whether a constant with a specified value exists in a enumeration of type E.

Declaration
public static bool IsDefined(E value)
Parameters
Type Name Description
E value

The value of a constant in E.

Returns
Type Description
Boolean

true if a constant in E has a value equal to value; otherwise, false.

| Improve this Doc View Source

IsDefined(String)

Returns an indication whether a constant with a specified name exists in a enumeration of type E.

Declaration
public static bool IsDefined(string name)
Parameters
Type Name Description
String name

The name of a constant in E.

Returns
Type Description
Boolean

true if a constant in E has a name equal to name; otherwise, false.

| Improve this Doc View Source

ToString()

Returns textual representation of the enum value.

Declaration
public override string ToString()
Returns
Type Description
String

The textual representation of the enum value.

| Improve this Doc View Source

TryGetMember(E, out Enum<E>)

Attempts to retrieve enum member which constant value is equal to the given value.

Declaration
public static bool TryGetMember(E value, out Enum<E> member)
Parameters
Type Name Description
E value

Enum value.

Enum<E> member

Enum member which constant value is equal to value.

Returns
Type Description
Boolean

true, if there are member declared the given constant value exist; otherwise, false.

| Improve this Doc View Source

TryGetMember(String, out Enum<E>)

Attempts to retrieve enum member which name is equal to the given value.

Declaration
public static bool TryGetMember(string name, out Enum<E> member)
Parameters
Type Name Description
String name

The name of a constant.

Enum<E> member

Enum member which name is equal to name.

Returns
Type Description
Boolean

true, if there are member declared the given constant value exist; otherwise, false.

Operators

| Improve this Doc View Source

Equality(Enum<E>, Enum<E>)

Determines whether two enum members are equal.

Declaration
public static bool operator ==(Enum<E> first, Enum<E> second)
Parameters
Type Name Description
Enum<E> first

The first member to compare.

Enum<E> second

The second member to compare.

Returns
Type Description
Boolean

true if this enum member is the same as other; otherwise, false.

| Improve this Doc View Source

Implicit(Enum<E> to E)

Converts typed enum wrapper into actual enum value.

Declaration
public static implicit operator E(in Enum<E> en)
Parameters
Type Name Description
Enum<E> en

Enum wrapper to convert.

Returns
Type Description
E
| Improve this Doc View Source

Inequality(Enum<E>, Enum<E>)

Determines whether two enum members are not equal.

Declaration
public static bool operator !=(Enum<E> first, Enum<E> second)
Parameters
Type Name Description
Enum<E> first

The first member to compare.

Enum<E> second

The second member to compare.

Returns
Type Description
Boolean

true if this enum member is not the same as other; otherwise, false.

Implements

IEquatable<>
IComparable<>
IFormattable
IEquatable<>
ISerializable

Extension Methods

ExpressionBuilder.Const<T>(T)

See Also

EnumMember API
  • Improve this Doc
  • View Source
Back to top Generated by DocFX