Show / Hide Table of Contents

    Class GenericEnum<TValue, TDerived>

    Basic enum implementation for a generic class that may provide additional properties, methods and implicit conversion operators as needed.

    Each enum member must be defined as public, static fields, initialised with an instance of the enum with the value they are supposed to represent. Optionally, the DescriptionAttribute attribute may be used to set a description. At runtime, the name of each member is automatically set to the name of the corresponding field and the description field it set to the value of the DescriptionAttribute, if any.

    An ArgumentException is thrown during static initialisation if two members use the same value.

    Inheritance
    Object
    GenericEnum<TValue, TDerived>
    EventIdEnum<TDerived>
    JsonRpcErrorCodes
    Implements
    IComparable
    System.IComparable<TDerived>
    System.Collections.Generic.IComparer<TDerived>
    System.IEquatable<TDerived>
    Namespace: XploRe.Runtime
    Assembly: XploRe.Runtime.dll
    Syntax
    public abstract class GenericEnum<TValue, TDerived> : Object, IComparable, IComparable<TDerived>, IComparer<TDerived>, IEquatable<TDerived> where TValue : struct, IComparable<TValue>, IEquatable<TValue>, ValueType where TDerived : GenericEnum<TValue, TDerived>
    Type Parameters
    Name Description
    TValue Type of enumeration value. Must be a value type that supports comparison and equality.
    TDerived The type of the derived class of the GenericEnum<TValue, TDerived>.

    Constructors

    Name Description
    GenericEnum(TValue) Initialises a new GenericEnum<TValue, TDerived> with a given value.

    Properties

    Name Description
    Description Optional description of enumeration member. Can be set via the DescriptionAttribute attribute.
    Name Name of enumeration member.
    Value Value of enumeration member.
    Values List over all enum member values of the enum type.

    Methods

    Name Description
    Compare(TDerived, TDerived)
    CompareTo(TDerived)
    CompareTo(Object)
    Equals(TDerived)
    Equals(Object)
    GetHashCode() The hash code of an enumeration member equals the hash code of the represented value.
    Parse(String) Yields the first member with a matching name.
    ToString() Returns the name of the field represented by the enum member.
    TryConvert(TValue, out TDerived) Tries to get the enumeration member with the specified value.

    Operators

    Name Description
    Implicit(TValue to GenericEnum<TValue, TDerived>) Retrieves the enumeration member for a given value.
    Implicit(GenericEnum<TValue, TDerived> to TValue) Yields the value represented by the enumeration member.
    Back to top Copyright © 2017-2018, xplo.re IT Services, Michael Maier. All rights reserved.