Beispiel #1
0
 /// <summary>
 /// 获取类型描述,使用DescriptionAttribute设置描述
 /// </summary>
 /// <typeparam name="T">类型</typeparam>
 public static string GetDescription <T>()
 {
     return(GetDescription(Common.GetType <T>()));
 }
Beispiel #2
0
 /// <summary>
 /// 获取显示名称,使用DisplayNameAttribute设置显示名称
 /// </summary>
 /// <typeparam name="T">类型</typeparam>
 public static string GetDisplayName <T>()
 {
     return(GetDisplayName(Common.GetType <T>()));
 }
Beispiel #3
0
 /// <summary>
 /// 获取类型成员描述,使用DescriptionAttribute设置描述
 /// </summary>
 /// <typeparam name="T">类型</typeparam>
 /// <param name="memberName">成员名称</param>
 public static string GetDescription <T>(string memberName)
 {
     return(GetDescription(Common.GetType <T>(), memberName));
 }
Beispiel #4
0
 /// <summary>
 /// 获取成员值
 /// </summary>
 /// <typeparam name="TEnum">枚举类型</typeparam>
 /// <param name="member">成员名、值、实例均可,范例:Enum1枚举有成员A=0,可传入"A"、0、Enum1.A,获取值0</param>
 public static int GetValue<TEnum>( object member )
 {
     return GetValue( Common.GetType<TEnum>(), member );
 }
Beispiel #5
0
 /// <summary>
 /// 获取成员名
 /// </summary>
 /// <typeparam name="TEnum">枚举类型</typeparam>
 /// <param name="member">成员名、值、实例均可,范例:Enum1枚举有成员A=0,则传入Enum1.A或0,获取成员名"A"</param>
 public static string GetName<TEnum>( object member )
 {
     return GetName( Common.GetType<TEnum>(), member );
 }
Beispiel #6
0
 /// <summary>
 /// 获取项集合,文本设置为Description,值为Value
 /// </summary>
 /// <typeparam name="TEnum">枚举类型</typeparam>
 public static List <Item> GetItems <TEnum>()
 {
     return(GetItems(Common.GetType <TEnum>()));
 }