Determines if a specified attribute is the same as an attribute in the collection.
[Visual Basic] Overloads Public Function Matches( _ ByVal attribute As MemberAttribute _ ) As Boolean [C#] public bool Matches( MemberAttribute attribute ); [C++] public: bool Matches( MemberAttribute* attribute ); [JScript] public function Matches( attribute : MemberAttribute ) : Boolean;
true if the attribute is contained within the collection and has the same value as the attribute in the collection; otherwise, false.
An attribute can provide support for matching.
The following example verifies that the BrowsableAttribute is a member of the collection and that it has been set to true. It assumes that Button1 has been instantiated on a form.
[Visual Basic]
Private Sub MatchesAttribute() 'Create a new collection and assign it the attributes for Button1. Dim attributes As MemberAttributeCollection attributes = TypeDescriptor.GetAttributes(Button1) 'Check to see if the browsable attribute is true. If attributes.Matches(BrowsableAttribute.Yes) Then TextBox1.Text = "Button1 is browsable" Else TextBox1.Text = "Button1 is not browsable" End If End Sub
MemberAttributeCollection Class | MemberAttributeCollection Members | System.ComponentModel Namespace | MemberAttributeCollection.Matches Overload List | MemberAttribute