Share via


CodeStatementCollection.Contains(CodeStatement) Metodo

Definizione

Ottiene un valore che indica se l'insieme contiene l'oggetto CodeStatement specificato.

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

Parametri

value
CodeStatement

L'oggetto CodeStatement da cercare nell'insieme.

Restituisce

true se l'insieme contiene l'oggetto specificato; in caso contrario, false.

Esempio

Nell'esempio seguente viene utilizzato il Contains metodo per cercare la presenza di un oggetto specifico CodeStatement e recuperare il valore di indice in corrispondenza del quale è stato trovato.

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

Si applica a

Vedi anche