Updated to C# 12
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
|
||||
namespace System
|
||||
@@ -41,13 +40,5 @@ namespace System
|
||||
/// <returns>The description or the string representation of the value.</returns>
|
||||
public static string GetDescription(this Enum value)
|
||||
=> value.GetAttribute<DescriptionAttribute>()?.Description ?? value.ToString();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the name from <see cref="DisplayAttribute"/>.
|
||||
/// </summary>
|
||||
/// <param name="value">The enum value.</param>
|
||||
/// <returns>The display name or the string representation of the value.</returns>
|
||||
public static string GetDisplayName(this Enum value)
|
||||
=> value.GetAttribute<DisplayAttribute>()?.Name ?? value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user