实现EnumHelper 类
using System;
using System.Collections.Generic;
public static class EnumHelper
{
public static int GetNumberByEnum<TEnum>(TEnum e)
{
return Convert.ToInt32(Enum.Parse(typeof(TEnum), e.ToString()));
}
public static TEnum GetEnumbyNumber<TEnum>(string number)
{
return (TEnum)Enum.Parse(typeof(TEnum), number);
}
}