using System; using System.Reflection; namespace YooAsset.Editor { /// /// 编辑器显示名字 /// public class DisplayNameAttribute : Attribute { public string DisplayName; public DisplayNameAttribute(string name) { this.DisplayName = name; } } public static class DisplayNameAttributeHelper { internal static T GetAttribute(Type type) where T : Attribute { return (T)type.GetCustomAttribute(typeof(T), false); } internal static T GetAttribute(MethodInfo methodInfo) where T : Attribute { return (T)methodInfo.GetCustomAttribute(typeof(T), false); } internal static T GetAttribute(FieldInfo field) where T : Attribute { return (T)field.GetCustomAttribute(typeof(T), false); } } }