Editar

Compartilhar via


CodeDirectiveCollection.Contains(CodeDirective) Method

Definition

Gets a value indicating whether the collection contains the specified CodeDirective object.

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

The CodeDirective object to search for in the collection.

Returns

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

Examples

The following code example shows the use of the Contains method to determine whether the collection contains a specific CodeDirective object. This example is part of a larger example provided for the CodeDirectiveCollection class.

// 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

Applies to