mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-23 09:56:36 +08:00
整理一下项目文件
This commit is contained in:
18
AIStudio.Wpf.DiagramDesigner/Helpers/EnumExtension.cs
Normal file
18
AIStudio.Wpf.DiagramDesigner/Helpers/EnumExtension.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
public static class EnumExtension
|
||||
{
|
||||
public static string GetDescription(this Enum value)
|
||||
{
|
||||
FieldInfo field = value.GetType().GetField(value.ToString());
|
||||
DescriptionAttribute attribute = Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) as DescriptionAttribute;
|
||||
|
||||
return attribute == null ? value.ToString() : attribute.Description;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user