using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Core.Helper
{
public static class EnumHelper
{
///
/// 获取枚举值的description文本
///
///
///
///
public static string GetDescription(Type type, string strVal)
{
System.Reflection.FieldInfo field = type.GetField(strVal);
if (field != null)
{
var attribute = Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) as DescriptionAttribute;
if (attribute != null)
{
return attribute.Description;
}
}
return string.Empty;
}
}
}