using System; using System.ComponentModel.DataAnnotations; namespace Win_in.Sfs.Shared; public static class DisplayNameExtensions { public static string GetNameOfDisplay(this Type type) { var displayName = type.Name; var attrs = type.GetCustomAttributes(typeof(DisplayAttribute), true); if (attrs.Length == 0) { return displayName; } var nameOfDisplay = ((DisplayAttribute)attrs[0]).Name; if (!string.IsNullOrEmpty(nameOfDisplay)) { displayName = nameOfDisplay; } return displayName; } }