예제 #1
0
        static public T GetCustomAttributeOfSubType <T>(this IDynamicCustomAttributeProvider item, Type attribute_type, bool inherit) where T : Attribute
        {
            T attribute;

            item.TryGetCustomAttributeOfSubType <T>(attribute_type, inherit, out attribute);
            return(attribute);
        }
예제 #2
0
        static public Attribute GetCustomAttributeOfType(this IDynamicCustomAttributeProvider item, Type attribute_type, bool inherit)
        {
            Attribute attribute;

            item.TryGetCustomAttributeOfType(attribute_type, inherit, out attribute);
            return(attribute);
        }
예제 #3
0
        static public bool HasCustomAttributeOfSubType <T>(this IDynamicCustomAttributeProvider item, Type attribute_type, bool inherit, Predicate <T> predicate) where T : Attribute
        {
            if (item.FindCustomAttributeOfSubType <T>(attribute_type, inherit, predicate) != null)
            {
                return(true);
            }

            return(false);
        }
예제 #4
0
        static public bool HasCustomAttribute(this IDynamicCustomAttributeProvider item, bool inherit, Predicate <Attribute> predicate)
        {
            if (item.FindCustomAttribute(inherit, predicate) != null)
            {
                return(true);
            }

            return(false);
        }
예제 #5
0
        static public bool HasCustomAttributeOfType(this IDynamicCustomAttributeProvider item, Type attribute_type, bool inherit)
        {
            if (item.GetCustomAttributeOfType(attribute_type, inherit) != null)
            {
                return(true);
            }

            return(false);
        }
예제 #6
0
        static public string GetCustomLabeledAttributeOfTypeLabel(this IDynamicCustomAttributeProvider item, Type attribute_type, bool inherit, string default_value = "")
        {
            string label;

            if (item.TryGetCustomLabeledAttributeOfTypeLabel(attribute_type, out label, inherit))
            {
                return(label);
            }

            return(default_value);
        }
예제 #7
0
        static public bool TryGetCustomLabeledAttributeOfTypeLabel(this IDynamicCustomAttributeProvider item, Type attribute_type, out string label, bool inherit)
        {
            LabeledAttribute labeled_attribute = item.GetCustomAttributeOfSubType <LabeledAttribute>(attribute_type, inherit);

            if (labeled_attribute != null)
            {
                label = labeled_attribute.GetLabel();
                return(true);
            }

            label = "";
            return(false);
        }
예제 #8
0
 static public T FindCustomAttributeOfSubType <T>(this IDynamicCustomAttributeProvider item, Type attribute_type, bool inherit, Predicate <T> predicate) where T : Attribute
 {
     return(item.GetAllCustomAttributesOfSubType <T>(attribute_type, inherit).FindFirst(predicate));
 }
예제 #9
0
 static public Attribute FindCustomAttributeOfType(this IDynamicCustomAttributeProvider item, Type attribute_type, bool inherit, Predicate <Attribute> predicate)
 {
     return(item.GetAllCustomAttributesOfType(attribute_type, inherit).FindFirst(predicate));
 }
예제 #10
0
 static public bool HasCustomForTypeAttributeOfType <T>(this IDynamicCustomAttributeProvider item, Type type) where T : ForTypeAttribute
 {
     return(item.HasCustomForTypeAttributeOfType(typeof(T), type));
 }
예제 #11
0
 static public IEnumerable <T> GetAllCustomAttributesOfType <T>(this IDynamicCustomAttributeProvider item, bool inherit) where T : Attribute
 {
     return(item.GetAllCustomAttributesOfType(typeof(T), inherit).Convert <Attribute, T>());
 }
예제 #12
0
 static public IEnumerable <Attribute> GetAllCustomAttributesOfType(this IDynamicCustomAttributeProvider item, Type attribute_type, bool inherit)
 {
     return(item.GetAllCustomAttributes(inherit).Narrow(a => a.CanObjectBeTreatedAs(attribute_type)));
 }
예제 #13
0
 static public bool TryGetCustomAttributeOfSubType <T>(this IDynamicCustomAttributeProvider item, Type attribute_type, bool inherit, out T attribute) where T : Attribute
 {
     return(item.GetAllCustomAttributesOfSubType <T>(attribute_type, inherit).TryGetFirst(out attribute));
 }
예제 #14
0
 static public bool TryGetCustomAttributeOfType(this IDynamicCustomAttributeProvider item, Type attribute_type, bool inherit, out Attribute attribute)
 {
     return(item.GetAllCustomAttributesOfType(attribute_type, inherit).TryGetFirst(out attribute));
 }
예제 #15
0
 static public bool HasCustomLabeledAttributeOfType(this IDynamicCustomAttributeProvider item, Type attribute_type, string label, bool inherit)
 {
     return(item.HasCustomAttributeOfSubType <LabeledAttribute>(attribute_type, inherit, it => it.IsLabeled(label)));
 }
예제 #16
0
 static public bool HasCustomLabeledAttributeOfType <T>(this IDynamicCustomAttributeProvider item, string label, bool inherit) where T : LabeledAttribute
 {
     return(item.HasCustomLabeledAttributeOfType(typeof(T), label, inherit));
 }
예제 #17
0
 static public IEnumerable <T> GetAllCustomAttributesOfSubType <T>(this IDynamicCustomAttributeProvider item, Type attribute_type, bool inherit) where T : Attribute
 {
     return(GetAllCustomAttributesOfType <T>(item, inherit).Narrow(a => a.CanObjectBeTreatedAs(attribute_type)));
 }
예제 #18
0
 static public bool TryGetCustomLabeledAttributeOfTypeLabel <T>(this IDynamicCustomAttributeProvider item, out string label, bool inherit) where T : LabeledAttribute
 {
     return(item.TryGetCustomLabeledAttributeOfTypeLabel(typeof(T), out label, inherit));
 }
예제 #19
0
 static public bool HasCustomAttributeOfType <T>(this IDynamicCustomAttributeProvider item, bool inherit) where T : Attribute
 {
     return(item.HasCustomAttributeOfType(typeof(T), inherit));
 }
예제 #20
0
 static public string GetCustomLabeledAttributeOfTypeLabel <T>(this IDynamicCustomAttributeProvider item, bool inherit, string default_value = "") where T : LabeledAttribute
 {
     return(item.GetCustomLabeledAttributeOfTypeLabel(typeof(T), inherit, default_value));
 }
예제 #21
0
 static public bool HasCustomForTypeAttributeOfType(this IDynamicCustomAttributeProvider item, Type attribute_type, Type type)
 {
     return(item.HasCustomAttributeOfSubType <ForTypeAttribute>(attribute_type, false, it => it.IsFor(type)));
 }