Skip to content

Commit

Permalink
Merge pull request #38 from ccnetcore/main
Browse files Browse the repository at this point in the history
feat: 完善内置枚举
  • Loading branch information
786744873 authored Oct 10, 2023
2 parents 4036cb8 + 7f5be76 commit af35771
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;

Check failure on line 4 in EasyTool.Core/ToolCategory/EnumUtil.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'DataAnnotations' does not exist in the namespace 'System.ComponentModel' (are you missing an assembly reference?)

Check failure on line 4 in EasyTool.Core/ToolCategory/EnumUtil.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'DataAnnotations' does not exist in the namespace 'System.ComponentModel' (are you missing an assembly reference?)
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 af35771

Please sign in to comment.