NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

MemberAttributeCollection.Contains (MemberAttribute)

Determines if this collection of attributes has the specified attribute.

[Visual Basic]
Overloads Public Function Contains( _
   ByVal attribute As MemberAttribute _
) As Boolean
[C#]
public bool Contains(
   MemberAttribute attribute
);
[C++]
public: bool Contains(
   MemberAttribute* attribute
);
[JScript]
public function Contains(
   attribute : MemberAttribute
) : Boolean;

Parameters

attribute
A MemberAttribute to find in the collection.

Return Value

true if the collection contains the attribute or is the default attribute for the type of attribute; otherwise, false.

Remarks

This collection has the specified attribute if the specified type of attribute exists in the collection and value the specified attribute is the same as the value of the instance of the attribute in the collection.

Example [Visual Basic]

The following example checks to see if the collection has a BrowsableAttribute set to true. It assumes that Button1 has been instantiated on a form.

[Visual Basic]

Private Sub ContainsAttribute()
   'Create a new collection and assign it the attributes for Button1.
   Dim attributes As MemberAttributeCollection
   attributes = TypeDescriptor.GetAttributes(Button1)

   'Set a MemberAttribute to a specific attribute.
   Dim myAttribute As BrowsableAttribute
   myAttribute = BrowsableAttribute.Yes

   If attributes.Contains(myAttribute) Then
      TextBox1.Text = "Button1 has a browsable attribute"
   Else
      TextBox1.Text = "Button1 does not have a browsable attribute"
   End If
End Sub

See Also

MemberAttributeCollection Class | MemberAttributeCollection Members | System.ComponentModel Namespace | MemberAttributeCollection.Contains Overload List | MemberAttribute