temu客户端程序
This commit is contained in:
commit
4aaf264e89
694 files changed
+263780
No files matched your search
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AllBase
|
||||
{
|
||||
public class EnumHelper
|
||||
{
|
||||
public static List<EnumMember> GetEnumMember(Type type)
|
||||
{
|
||||
List<EnumMember> list = new List<EnumMember>();
|
||||
foreach (var d in Enum.GetValues(type))
|
||||
{
|
||||
string desc = (d.GetType().GetField(d.ToString()).GetCustomAttribute(typeof(EnumDescriptionAttribute)) as EnumDescriptionAttribute).Description;
|
||||
list.Add(new EnumMember(d.ToString(), (int)d, desc));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
public class EnumMember
|
||||
{
|
||||
public string Name;
|
||||
public int Value;
|
||||
public string Description;
|
||||
public EnumMember(string name, int value, string description)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Value = value;
|
||||
this.Description = description;
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return this.Description;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 枚举注释的自定义属性类
|
||||
/// </summary>
|
||||
public class EnumDescriptionAttribute : Attribute
|
||||
{
|
||||
private string m_strDescription;
|
||||
public EnumDescriptionAttribute(string strPrinterName)
|
||||
{
|
||||
m_strDescription = strPrinterName;
|
||||
}
|
||||
public string Description
|
||||
{
|
||||
get { return m_strDescription; }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user