first commit

This commit is contained in:
2026-09-02 16:31:50 +08:00
commit a461727193
911 changed files with 692450 additions and 0 deletions
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace JSMachine.WMS.Infrastructure
{
public static class EnumExtension
{
/// <summary>
/// 获取枚举描述属性值
/// </summary>
/// <param name="enum"></param>
/// <returns></returns>
public static string GetDescription(this Enum @enum)
{
Type type = @enum.GetType();
string name = Enum.GetName(type, @enum);
if (string.IsNullOrWhiteSpace(name))
return @enum.ToString();
FieldInfo field = type.GetField(name);
DescriptionAttribute des = field?.GetCustomAttribute<DescriptionAttribute>();
if (des == null)
return @enum.ToString();
return des.Description;
}
}
}