Determines if this collection of attributes has the specified attribute or array of attributes.
Determines if this collection of attributes has the specified attribute.
[Visual Basic] Overloads Public Function Contains(MemberAttribute) As Boolean
[C#] public bool Contains(MemberAttribute);
[C++] public: bool Contains(MemberAttribute*);
[JScript] public function Contains(MemberAttribute) : Boolean;
Determines if this attribute collection contains the all the specified attributes in the attribute array.
[Visual Basic] Overloads Public Function Contains(MemberAttribute()) As Boolean
[C#] public bool Contains(MemberAttribute[]);
[C++] public: bool Contains(MemberAttribute*[]);
[JScript] public function Contains(MemberAttribute[]) : Boolean;
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.
Note This example shows how to use one of the overloaded versions of Contains. For other examples that may be available, see the individual overload topics.
[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