Determines if the attributes in the specified array are the same as the attributes in the collection.
[Visual Basic] Overloads Public Function Matches( _ ByVal attributes() As MemberAttribute _ ) As Boolean [C#] public bool Matches( MemberAttribute[] attributes ); [C++] public: bool Matches( MemberAttribute* attributes[] ); [JScript] public function Matches( attributes : MemberAttribute[] ) : Boolean;
true if all the attributes in the array are contained in the collection and have the same values as the attributes in the collection; otherwise, false.
An attribute can provide support for matching.
The following example compares the attributes in two buttons. It assumes that both buttons have been instantiated on a form.
[Visual Basic]
Private Sub MatchesAttributes() 'Create a new collection and assign it the attributes for Button1. Dim collection1 As MemberAttributeCollection collection1 = TypeDescriptor.GetAttributes(Button1) 'Create a new collection and assign it the attributes for TextBox1. Dim collection2 As MemberAttributeCollection collection2 = TypeDescriptor.GetAttributes(TextBox1) 'Check to see if the attributes in collection1 are contained in collection2. If collection1.Matches(collection2.All) Then TextBox1.Text = "The attributes in the button and the text box match" Else TextBox1.Text = "The attributes in the button and the text box do not match" End If End Sub
MemberAttributeCollection Class | MemberAttributeCollection Members | System.ComponentModel Namespace | MemberAttributeCollection.Matches Overload List | MemberAttribute