Determines if this attribute collection contains the all the specified attributes in the attribute array.
[Visual Basic] Overloads Public Function Contains( _ ByVal attributes() As MemberAttribute _ ) As Boolean [C#] public bool Contains( MemberAttribute[] attributes ); [C++] public: bool Contains( MemberAttribute* attributes[] ); [JScript] public function Contains( attributes : MemberAttribute[] ) : Boolean;
true if the collection contains all the attributes; otherwise, false.
This collection has the specified array of attributes if all the specified attribute types exist in the collection and each attribute in the specified array is the same as an attribute in the collection.
The following example compares the attributes in Button1 and Edit1 to see if the attributes for Edit1 are contained in the attributes
for Button1. It assumes that both Button1 and Edit1 have been instantiated on a form.
[Visual Basic]
Private Sub ContainsAttributes() '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.Contains(collection2.All) Then TextBox1.Text = "Both the button and the text box contain the same attributes" Else TextBox1.Text = "The button and the text box do not contain the same attributes" End If End Sub
MemberAttributeCollection Class | MemberAttributeCollection Members | System.ComponentModel Namespace | MemberAttributeCollection.Contains Overload List | MemberAttribute