using System; namespace AntDesign { public abstract class EnumValue : IEquatable>, IComparable> where TEnum : EnumValue where TValue : IEquatable, IComparable { public string Name { get; set; } public TValue Value { get; set; } protected EnumValue(string name, TValue value) { this.Name = name; this.Value = value; } public bool Equals(EnumValue other) { if (ReferenceEquals(this, other)) return true; if (other is null) return false; return Value.Equals(other.Value); } public int CompareTo(EnumValue other) { return Value.CompareTo(other.Value); } public override string ToString() { return Name; } } public abstract class EnumValue : EnumValue where TEnum : EnumValue { protected EnumValue(string name, int value) : base(name, value) { } } }