Beispiel #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)));
 }
Beispiel #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)));
 }
Beispiel #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)));
 }
Beispiel #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)));
 }