数字转换枚举

var status = new Enums.AffairsOperatingResult();
int typeNum = 0;
int.TryParse(statusStr, out typeNum);
try
{

status = (Enums.AffairsOperatingResult)Enum.Parse(typeof(Enums.AffairsOperatingResult),
typeof(Enums.AffairsOperatingResult).GetEnumName(typeNum));

}
catch (Exception)
{
}

你可能感兴趣的:(枚举)