CodeDirectiveCollection.Contains(CodeDirective) Methode

Definitie

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

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

Parameters

value
CodeDirective

Het CodeDirective object waarnaar moet worden gezocht in de verzameling.

Retouren

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

Voorbeelden

In het volgende codevoorbeeld ziet u het gebruik van de Contains methode om te bepalen of de verzameling een specifiek CodeDirective object bevat. Dit voorbeeld maakt deel uit van een groter voorbeeld voor de CodeDirectiveCollection klasse.

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

Van toepassing op