AttributeCollection::Matches Method (array<Attribute^>^)
Determines whether the attributes in the specified array are the same as the attributes in the collection.
Assembly: System (in System.dll)
Parameters
- attributes
-
Type:
array<System::Attribute^>^
An array of MemberAttributes to compare with the attributes in this collection.
Return Value
Type: System::Booleantrue 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 code example compares the attributes in a button and a text box to see whether they match. It assumes that button1 and textBox1 have been created on a form.
private: void MatchesAttributes() { // Creates a new collection and assigns it the attributes for button1. AttributeCollection^ myCollection; myCollection = TypeDescriptor::GetAttributes( button1 ); // Checks to see whether the attributes in myCollection match the attributes for textBox1. array<Attribute^>^ myAttrArray = gcnew array<Attribute^>(100); TypeDescriptor::GetAttributes( textBox1 )->CopyTo( myAttrArray, 0 ); if ( myCollection->Matches( myAttrArray ) ) { textBox1->Text = "The attributes in the button and text box match."; } else { textBox1->Text = "The attributes in the button and text box do not match."; } }
Available since 1.1