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); }
static public Attribute GetCustomAttributeOfType(this IDynamicCustomAttributeProvider item, Type attribute_type, bool inherit) { Attribute attribute; item.TryGetCustomAttributeOfType(attribute_type, inherit, out attribute); return(attribute); }
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); }
static public bool HasCustomAttribute(this IDynamicCustomAttributeProvider item, bool inherit, Predicate <Attribute> predicate) { if (item.FindCustomAttribute(inherit, predicate) != null) { return(true); } return(false); }
static public bool HasCustomAttributeOfType(this IDynamicCustomAttributeProvider item, Type attribute_type, bool inherit) { if (item.GetCustomAttributeOfType(attribute_type, inherit) != null) { return(true); } return(false); }
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); }
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); }
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)); }
static public Attribute FindCustomAttributeOfType(this IDynamicCustomAttributeProvider item, Type attribute_type, bool inherit, Predicate <Attribute> predicate) { return(item.GetAllCustomAttributesOfType(attribute_type, inherit).FindFirst(predicate)); }
static public bool HasCustomForTypeAttributeOfType <T>(this IDynamicCustomAttributeProvider item, Type type) where T : ForTypeAttribute { return(item.HasCustomForTypeAttributeOfType(typeof(T), type)); }
static public IEnumerable <T> GetAllCustomAttributesOfType <T>(this IDynamicCustomAttributeProvider item, bool inherit) where T : Attribute { return(item.GetAllCustomAttributesOfType(typeof(T), inherit).Convert <Attribute, T>()); }
static public IEnumerable <Attribute> GetAllCustomAttributesOfType(this IDynamicCustomAttributeProvider item, Type attribute_type, bool inherit) { return(item.GetAllCustomAttributes(inherit).Narrow(a => a.CanObjectBeTreatedAs(attribute_type))); }
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)); }
static public bool TryGetCustomAttributeOfType(this IDynamicCustomAttributeProvider item, Type attribute_type, bool inherit, out Attribute attribute) { return(item.GetAllCustomAttributesOfType(attribute_type, inherit).TryGetFirst(out attribute)); }
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))); }
static public bool HasCustomLabeledAttributeOfType <T>(this IDynamicCustomAttributeProvider item, string label, bool inherit) where T : LabeledAttribute { return(item.HasCustomLabeledAttributeOfType(typeof(T), label, inherit)); }
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))); }
static public bool TryGetCustomLabeledAttributeOfTypeLabel <T>(this IDynamicCustomAttributeProvider item, out string label, bool inherit) where T : LabeledAttribute { return(item.TryGetCustomLabeledAttributeOfTypeLabel(typeof(T), out label, inherit)); }
static public bool HasCustomAttributeOfType <T>(this IDynamicCustomAttributeProvider item, bool inherit) where T : Attribute { return(item.HasCustomAttributeOfType(typeof(T), inherit)); }
static public string GetCustomLabeledAttributeOfTypeLabel <T>(this IDynamicCustomAttributeProvider item, bool inherit, string default_value = "") where T : LabeledAttribute { return(item.GetCustomLabeledAttributeOfTypeLabel(typeof(T), inherit, default_value)); }
static public bool HasCustomForTypeAttributeOfType(this IDynamicCustomAttributeProvider item, Type attribute_type, Type type) { return(item.HasCustomAttributeOfSubType <ForTypeAttribute>(attribute_type, false, it => it.IsFor(type))); }