コード例 #1
0
 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));
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
        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));
        }
コード例 #4
0
        public static string GetDisplayName(this MemberInfo member)
        {
            var attr = MemberInfoExtensions.GetDistinctAttribute <DisplayNameAttribute>(member, true);

            if (attr != null)
            {
                return(attr.DisplayName);
            }
            else
            {
                return(member.Name);
            }
        }
コード例 #5
0
 public static IEnumerable <TAttribute> GetAttributes <TAttribute>(this MemberInfo member, bool inherit)
     where TAttribute : Attribute
 {
     return(MemberInfoExtensions.GetAttributes(member, inherit).OfType <TAttribute>());
 }