From 18a8fab394f764e5b30c48c8e0d6887ef7d44cbf Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期二, 29 十月 2024 14:22:49 +0800
Subject: [PATCH] 取消拆单

---
 CoreCms.Net.Utility/Extensions/ObjectExtensions.cs |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/CoreCms.Net.Utility/Extensions/ObjectExtensions.cs b/CoreCms.Net.Utility/Extensions/ObjectExtensions.cs
index 2f02087..9661063 100644
--- a/CoreCms.Net.Utility/Extensions/ObjectExtensions.cs
+++ b/CoreCms.Net.Utility/Extensions/ObjectExtensions.cs
@@ -14,6 +14,7 @@
 
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Text;
 
 namespace CoreCms.Net.Utility.Extensions
@@ -174,8 +175,18 @@
             return thisValue != null && thisValue != DBNull.Value && bool.TryParse(thisValue.ToString(), out result) ? result : result;
         }
 
-
-
+        /// <summary>
+        /// 鑾峰彇鏋氫妇鐨勬爣娉ㄧ殑鍊�
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        public static string GetDescription(this Enum value) 
+        {
+            var field = value.GetType().GetField(value.ToString());
+            var attributes = (DescriptionAttribute[])field.GetCustomAttributes(typeof(DescriptionAttribute), false);
+            return attributes.Length > 0 ? attributes[0].Description : value.ToString();
+        }
 
     }
 }

--
Gitblit v1.9.1