Esempio n. 1
0
 /// <summary>
 /// 取值
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="s"></param>
 /// <returns></returns>
 public static string ToEnumString <T>(this int?s) where T : EnumBase
 {
     if (s.HasValue)
     {
         return(EnumBase.GetDescription(typeof(T), s.Value, false));
     }
     return("");
 }
Esempio n. 2
0
 /// <summary>
 /// 取值
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="s"></param>
 /// <returns></returns>
 public static string ToEnumString <T>(this int s) where T : EnumBase
 {
     return(EnumBase.GetDescription(typeof(T), s, false));
 }
Esempio n. 3
0
 /// <summary>
 /// 获取枚举描述
 /// </summary>
 /// <param name="enumValue"></param>
 /// <param name="value"></param>
 /// <returns></returns>
 public static string GetDescription(this EnumBase enumValue, int value)
 {
     return(EnumBase.GetDescription(enumValue.GetType(), value, false));
 }