Exemplo n.º 1
0
 /// <summary>
 /// Get description via <see cref="System.ComponentModel.DescriptionAttribute"/> <br />
 /// 获取描述,使用 <see cref="System.ComponentModel.DescriptionAttribute"/> 特性设置描述
 /// </summary>
 /// <param name="enumType"></param>
 /// <param name="member"></param>
 /// <returns></returns>
 public static string DescriptionOf(Type enumType, object member)
 {
     return(Reflections.GetDescription(enumType, NameOf(enumType, member)));
 }
Exemplo n.º 2
0
 /// <summary>
 /// 获取描述,使用System.ComponentModel.Description特性设置描述
 /// </summary>
 /// <param name="typeinfo">枚举类型</param>
 /// <param name="member">成员名、值、实例均可</param>
 public static string GetDescription(TypeInfo typeinfo, object member)
 {
     return(Reflections.GetDescription(typeinfo, NameOf(typeinfo, member)));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Get description via <see cref="System.ComponentModel.DescriptionAttribute"/> <br />
 /// 获取描述,使用 <see cref="System.ComponentModel.DescriptionAttribute"/> 特性设置描述
 /// </summary>
 /// <param name="member"></param>
 /// <typeparam name="TEnum"></typeparam>
 /// <returns></returns>
 public static string DescriptionOf <TEnum>(TEnum member) where TEnum : struct, Enum
 {
     return(Reflections.GetDescription <TEnum>(NameOf(member)));
 }
Exemplo n.º 4
0
 /// <summary>
 /// 获取描述,使用System.ComponentModel.Description特性设置描述
 /// </summary>
 /// <typeparam name="T">枚举</typeparam>
 /// <param name="member">成员名、值、实例均可</param>
 public static string GetDescription <T>(object member)
 {
     return(Reflections.GetDescription <T>(NameOf <T>(member)));
 }