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
-
IEquatable<Enumeration<TKey>>
- 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
Properties
Data
数据
public object Data { get; set; }
Property Value
Description
描述
public string Description { get; set; }
Property Value
Id
Gets or sets the identifier.
public Guid Id { get; set; }
Property Value
MaxDescriptionLength
public static int MaxDescriptionLength { get; set; }
Property Value
MaxNameLength
public static int MaxNameLength { get; set; }
Property Value
MaxValueLength
public static int MaxValueLength { get; set; }
Property Value
Name
枚举名
public string Name { get; set; }
Property Value
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
FromName<T>(string)
Froms the name.
public static T FromName<T>(string name) where T : Enumeration<T>, new()
Parameters
name
stringThe 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
TThe 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
TypeThe 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
stringThe 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
TThe 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
stringThe name.
ToString()
Converts to string.
public override string ToString()