using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OASystem.Domain.Enums
{
///
/// 月份枚举
///
public enum MonthEnum
{
///
/// 一月
///
[Description("一月")]
Jan = 1,
///
/// 二月
///
[Description("二月")]
Feb,
///
/// 三月
///
[Description("三月")]
Mar,
///
/// 四月
///
[Description("四月")]
Apr,
///
/// 五月
///
[Description("五月")]
May,
///
/// 六月
///
[Description("六月")]
Jun,
///
/// 七月
///
[Description("七月")]
Jul,
///
/// 八月
///
[Description("八月")]
Aug,
///
/// 九月
///
[Description("九月")]
Sep,
///
/// 十月
///
[Description("十月")]
Oct,
///
/// 十一月
///
[Description("十一月")]
Nov,
///
/// 十二月
///
[Description("十二月")]
Dec,
}
static class EnumExtensions
{
public static string GetDescription(this Enum val)
{
var field = val.GetType().GetField(val.ToString());
var customAttribute = Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute));
return customAttribute == null ? val.ToString() : ((DescriptionAttribute)customAttribute).Description;
}
}
}