public static bool CheckMutualAttributes <TTrueAttribute, TFalseAttribute>( this MemberInfo member, out TTrueAttribute trueAttribute, out TFalseAttribute falseAttribute) where TTrueAttribute : Attribute where TFalseAttribute : Attribute { return(MemberInfoExtensions.CheckMutualAttributes(member, false, out trueAttribute, out falseAttribute)); }
public static bool CheckMutualAttributes <TTrueAttribute, TFalseAttribute>( this MemberInfo member, bool defaultValue, out TTrueAttribute trueAttribute, out TFalseAttribute falseAttribute) where TTrueAttribute : Attribute where TFalseAttribute : Attribute { falseAttribute = MemberInfoExtensions.GetDistinctAttribute <TFalseAttribute>(member, false); if (falseAttribute == null) { trueAttribute = MemberInfoExtensions.GetDistinctAttribute <TTrueAttribute>(member, true); if (trueAttribute != null) { return(true); } else { trueAttribute = null; return(defaultValue); } } else { trueAttribute = null; return(false); } }
public static bool CheckMutualAttributes <TTrueAttribute, TFalseAttribute>( this MemberInfo member, bool defaultValue) where TTrueAttribute : Attribute where TFalseAttribute : Attribute { TTrueAttribute trueAttr; TFalseAttribute falseAttr; return(MemberInfoExtensions.CheckMutualAttributes(member, defaultValue, out trueAttr, out falseAttr)); }
public static string GetDisplayName(this MemberInfo member) { var attr = MemberInfoExtensions.GetDistinctAttribute <DisplayNameAttribute>(member, true); if (attr != null) { return(attr.DisplayName); } else { return(member.Name); } }
public static IEnumerable <TAttribute> GetAttributes <TAttribute>(this MemberInfo member, bool inherit) where TAttribute : Attribute { return(MemberInfoExtensions.GetAttributes(member, inherit).OfType <TAttribute>()); }