Browse Source

修复ToNameWithDescription不正确的问题

zhontai 2 years ago
parent
commit
e1380451cf
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/platform/ZhonTai.Common/Extensions/EnumExtension.cs

+ 1 - 1
src/platform/ZhonTai.Common/Extensions/EnumExtension.cs

@@ -19,7 +19,7 @@ public static class EnumExtension
     {
         string name = item.ToString();
         var desc = item.GetType().GetField(name)?.GetCustomAttribute<DescriptionAttribute>();
-        return $"name{(desc != null && desc.Description.IsNull() ? "" : $"({desc?.Description})")}";
+        return $"{name}{(desc == null || desc.Description.IsNull() ? "" : $"({desc?.Description})")}";
     }
 
     public static long ToInt64(this Enum item)