CodeTypeDeclarationCollection.Contains(CodeTypeDeclaration) Methode

Definitie

Hiermee wordt een waarde opgehaald die aangeeft of de verzameling het opgegeven CodeTypeDeclaration object bevat.

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

Parameters

value
CodeTypeDeclaration

Het CodeTypeDeclaration object waarnaar moet worden gezocht in de verzameling.

Retouren

true als de verzameling het opgegeven object bevat; anders, false.

Voorbeelden

In het volgende voorbeeld ziet u hoe u de Contains methode gebruikt om een CodeTypeDeclaration object in een CodeTypeDeclarationCollection.

// Tests for the presence of a CodeTypeDeclaration in the
// collection, and retrieves its index if it is found.
CodeTypeDeclaration testDeclaration = new CodeTypeDeclaration("TestType");
int itemIndex = -1;
if( collection.Contains( testDeclaration ) )
    itemIndex = collection.IndexOf( testDeclaration );
' Tests for the presence of a CodeTypeDeclaration in the 
' collection, and retrieves its index if it is found.
Dim testDeclaration As New CodeTypeDeclaration("TestType")
Dim itemIndex As Integer = -1
If collection.Contains(testDeclaration) Then
    itemIndex = collection.IndexOf(testDeclaration)
End If

Van toepassing op

Zie ook