- attr
- Documentation for this section has not yet been entered.
true if the collection contains the attribute or is the default attribute for the type of attribute; otherwise, false.
This collection has the specified attribute if the specified type of attribute exists in the collection, and if the value of the specified attribute is the same as the value of the instance of the attribute in the collection.
The difference between the AttributeCollection.Matches(Attribute) and AttributeCollection.Contains(Attribute) methods is that AttributeCollection.Matches(Attribute) calls the Attribute.Match(object) method on an attribute, and AttributeCollection.Contains(Attribute) calls the object.Equals(object) method.
For most attributes, these methods do the same thing. For attributes that may have multiple flags, however, Attribute.Match(object) is typically implemented so that it returns true if any of the flags are satisfied. For example, consider a data binding attribute with the Boolean flags "SupportsSql", "SupportsOleDb", and "SupportsXml". This attribute may be present on a property that supports all three data-binding approaches. It will often be the case that a programmer needs to know only if a particular approach is available, not all three. Therefore, a programmer could use Attribute.Match(object) with an instance of the attribute containing only the flags the programmer needs.