Class Enumeration
Base class for creating enumeration types that behave like strongly-typed enum alternatives with rich behavior.
public abstract class Enumeration : IComparable
- Inheritance
-
Enumeration
- Implements
- Inherited Members
- Extension Methods
Constructors
Enumeration(int, string)
Initializes a new instance of the Enumeration class.
protected Enumeration(int id, string name)
Parameters
Properties
Id
Gets the numeric identifier for this enumeration value.
public int Id { get; }
Property Value
Name
Gets the display name for this enumeration value.
public string Name { get; }
Property Value
Methods
CompareTo(object)
Compares this enumeration value to another by their Id.
public int CompareTo(object other)
Parameters
otherobjectThe object to compare to.
Returns
- int
A value indicating the relative order of the objects being compared.
Equals(object)
Determines whether the specified object is equal to this enumeration value by comparing type and Id.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with this instance.
Returns
GetAll<T>()
Gets all declared enumeration values of the specified type.
public static IEnumerable<T> GetAll<T>() where T : Enumeration
Returns
- IEnumerable<T>
An enumerable of all public static fields of the specified enumeration type.
Type Parameters
TThe enumeration type to retrieve values for.
GetHashCode()
Returns a hash code for this enumeration value.
public override int GetHashCode()
Returns
- int
A hash code for the current instance.
ToString()
Returns the display name of this enumeration value.
public override string ToString()