方法:Enum.IsDefined
参数
- enumType
- 类型:System.Type
枚举类型。
- value
- 类型:System.Object
enumType 的常数的值或名称。
{
None = 0, Dog = 1, Cat = 2, Rodent = 4, Bird = 8, Reptile = 16, Other = 32
};
object value;
Console.WriteLine("{0}: {1}", value, Enum.IsDefined(typeof(PetType), value)); 标签:PetType,包含,Enum,指定,IsDefined,System,枚举,value From: https://www.cnblogs.com/itjeff/p/18023145