Table of Contents

Class Enumeration

Namespace
Tharga.Toolkit
Assembly
Tharga.Toolkit.Standard.dll

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

id int

The numeric identifier.

name string

The display name.

Properties

Id

Gets the numeric identifier for this enumeration value.

public int Id { get; }

Property Value

int

Name

Gets the display name for this enumeration value.

public string Name { get; }

Property Value

string

Methods

CompareTo(object)

Compares this enumeration value to another by their Id.

public int CompareTo(object other)

Parameters

other object

The 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

obj object

The object to compare with this instance.

Returns

bool

True if the objects are the same type and have the same Id; otherwise, false.

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

T

The 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()

Returns

string

The Name of this enumeration value.