Breyta

Deila með


CodeTypeMemberCollection.Contains(CodeTypeMember) Method

Definition

Gets a value indicating whether the collection contains the specified CodeTypeMember.

public:
 bool Contains(System::CodeDom::CodeTypeMember ^ value);
public bool Contains (System.CodeDom.CodeTypeMember value);
member this.Contains : System.CodeDom.CodeTypeMember -> bool
Public Function Contains (value As CodeTypeMember) As Boolean

Parameters

value
CodeTypeMember

The CodeTypeMember to search for in the collection.

Returns

true if the collection contains the specified object; otherwise, false.

Examples

The following code example uses the Contains method to search for the presence of a specific CodeTypeMember object and retrieve the index value at which it was found.

// Tests for the presence of a CodeTypeMember in the collection, 
// and retrieves its index if it is found.
CodeTypeMember^ testMember = gcnew CodeMemberField( "System.String","TestStringField" );
int itemIndex = -1;
if ( collection->Contains( testMember ) )
   itemIndex = collection->IndexOf( testMember );
// Tests for the presence of a CodeTypeMember in the collection,
// and retrieves its index if it is found.
CodeTypeMember testMember = new CodeMemberField("System.String", "TestStringField");
int itemIndex = -1;
if( collection.Contains( testMember ) )
    itemIndex = collection.IndexOf( testMember );
' Tests for the presence of a CodeTypeMember within the collection, and retrieves its index if it is within the collection.
Dim testMember = New CodeMemberField("System.String", "TestStringField")
Dim itemIndex As Integer = -1
If collection.Contains(testMember) Then
    itemIndex = collection.IndexOf(testMember)
End If

Applies to

See also