using System; using System.Diagnostics.CodeAnalysis; using System.Reflection; namespace Falcon.SugarApi { /// /// 类型相关扩展 /// public static class TypeExtend { /// /// 尝试获取Attribute /// /// Attribute类型 /// 属性 /// 定义的特性 /// 定义返回True,否则False public static bool TryGetAttribute([NotNull] this PropertyInfo info, out T p) where T : Attribute { p = info.GetCustomAttribute(); return p != null; } } }