Ejemplo n.º 1
0
 public static IDictionary <int, string> GetEnum <T>(this ILocalizationSource localizationSource) where T : Enum
 {
     return(localizationSource.GetEnum(typeof(T)));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 获取指定枚举值对应的本地化文本
 /// 如:Gender.Man  则获取 “男”
 /// </summary>
 /// <typeparam name="T">枚举类型</typeparam>
 /// <param name="localizationSource"></param>
 /// <param name="obj"></param>
 /// <returns></returns>
 public static string GetEnum <T>(this ILocalizationSource localizationSource, T obj) where T : Enum
 {
     return(localizationSource.GetEnum(obj as Enum));
 }