Skip to content

Commit

Permalink
feat: 完善内置枚举
Browse files Browse the repository at this point in the history
  • Loading branch information
陈淳 committed Sep 27, 2023
1 parent b59cb4f commit 7f5be76
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions EasyTool.Core/ToolCategory/EnumUtil.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Text;
Expand Down Expand Up @@ -235,32 +236,4 @@ public static string GetDisplayNameByValue<TEnum>(TEnum value)
return GetDisplayName(GetValueByName<TEnum>(name));
}
}

/// <summary>
/// 枚举成员的Description特性类,用于设置成员的注释
/// </summary>
[AttributeUsage(AttributeTargets.Field)]
public class DescriptionAttribute : Attribute
{
public string Description { get; set; }

public DescriptionAttribute(string description)
{
Description = description;
}
}

/// <summary>
/// 枚举成员的Display特性类,用于设置成员的Display名称
/// </summary>
[AttributeUsage(AttributeTargets.Field)]
public class DisplayAttribute : Attribute
{
public string Name { get; set; }

public DisplayAttribute(string name)
{
Name = name;
}
}
}

0 comments on commit 7f5be76

Please sign in to comment.