📅  最后修改于: 2022-03-11 14:48:52.656000             🧑  作者: Mango
if (Enum.IsDefined(typeof(YourEnum), yourInt))
{
return (YourEnum) yourInt;
}
OR:
if (Enum.IsDefined(typeof(YourEnum), yourInt))
{
return (YourEnum) Enum.ToObject(typeof(YourEnum), yourInt);
}