Table of Contents

Class Enumeration<TKey>

Namespace
CMS.Plugin.MesSuite.Abstractions.Enums
Assembly
CMS.Plugin.MesSuite.Abstractions.dll

枚举类

public abstract class Enumeration<TKey> : IEquatable<Enumeration<TKey>>

Type Parameters

TKey
Inheritance
Enumeration<TKey>
Implements
Derived
Inherited Members

Constructors

Enumeration()

Initializes a new instance of the StringEnumeration class.

protected Enumeration()

Enumeration(TKey, string, string)

Initializes a new instance of the StringEnumeration class.

protected Enumeration(TKey value, string name, string description = null)

Parameters

value TKey

The identifier.

name string

The name.

description string

Properties

Data

数据

public object Data { get; set; }

Property Value

object

Description

描述

public string Description { get; set; }

Property Value

string

Id

Gets or sets the identifier.

public Guid Id { get; set; }

Property Value

Guid

MaxDescriptionLength

public static int MaxDescriptionLength { get; set; }

Property Value

int

MaxNameLength

public static int MaxNameLength { get; set; }

Property Value

int

MaxValueLength

public static int MaxValueLength { get; set; }

Property Value

int

Name

枚举名

public string Name { get; set; }

Property Value

string

Value

枚举值

public TKey Value { get; set; }

Property Value

TKey

Methods

Equals(Enumeration<TKey>)

Indicates whether the current object is equal to another object of the same type.

public virtual bool Equals(Enumeration<TKey> other)

Parameters

other Enumeration<TKey>

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

FromName<T>(string)

Froms the name.

public static T FromName<T>(string name) where T : Enumeration<T>, new()

Parameters

name string

The name.

Returns

T

Type Parameters

T

FromValue<T>(T)

Froms the value.

public static T FromValue<T>(T value) where T : Enumeration<T>, new()

Parameters

value T

The value.

Returns

T

Type Parameters

T

GetAll<T>()

Gets all.

public static IEnumerable<T> GetAll<T>() where T : Enumeration<T>, new()

Returns

IEnumerable<T>

Type Parameters

T

GetAll<T>(Type)

Gets all.

public static IEnumerable<T> GetAll<T>(Type type) where T : Enumeration<T>, new()

Parameters

type Type

The type.

Returns

IEnumerable<T>

Type Parameters

T

GetByName<T>(string)

Gets the name of the by.

public static T GetByName<T>(string name) where T : Enumeration<T>, new()

Parameters

name string

The name.

Returns

T

Type Parameters

T

GetByValue<T>(T)

Gets the by identifier.

public static T GetByValue<T>(T id) where T : Enumeration<T>, new()

Parameters

id T

The identifier.

Returns

T

Type Parameters

T

GetHashCode()

Returns a hash code for this instance.

public override int GetHashCode()

Returns

int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

ModifyName(string)

Modifies the name.

public void ModifyName(string name)

Parameters

name string

The name.

ToString()

Converts to string.

public override string ToString()

Returns

string