public static string GetDisplayName(this ICustomAttributeProvider member) { return member.GetCustomAttributes(typeof(DisplayNameAttribute), false) .OfType<DisplayNameAttribute>() .Select(attribute => attribute.DisplayName) .LastOrDefault(); }