初始化项目
This commit is contained in:
43
AUTS.Services/Tool/System/EnumHelper.cs
Normal file
43
AUTS.Services/Tool/System/EnumHelper.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AUTS.Services.Tool
|
||||
{
|
||||
/// <summary>
|
||||
/// 枚举帮助类
|
||||
/// </summary>
|
||||
public static class EnumHelper
|
||||
{
|
||||
|
||||
///// <summary>
|
||||
///// 获取枚举的Short类型
|
||||
///// </summary>
|
||||
///// <param name="value"></param>
|
||||
///// <returns></returns>
|
||||
//public static short GetShortValue(Enum value)
|
||||
//{
|
||||
// return short.Parse(((int)Enum.Parse(value.GetType(), value.ToString())).ToString());
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 得到枚举中文备注
|
||||
///// </summary>
|
||||
///// <param name="enumValue"></param>
|
||||
///// <returns></returns>
|
||||
//public static string GetEnumDesc(Enum enumValue)
|
||||
//{
|
||||
// string value = enumValue.ToString();
|
||||
// FieldInfo field = enumValue.GetType().GetField(value);
|
||||
// object[] objs = field.GetCustomAttributes(typeof(DescriptionAttribute), false); //获取描述属性
|
||||
// if (objs.Length == 0) //当描述属性没有时,直接返回名称
|
||||
// return value;
|
||||
// DescriptionAttribute descriptionAttribute = (DescriptionAttribute)objs[0];
|
||||
// return descriptionAttribute.Description;
|
||||
//}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user