CodeExpressionCollection.Contains(CodeExpression) Methode

Definition

Ruft einen Wert ab, der angibt, ob die Auflistung das angegebene CodeExpression-Objekt enthält.

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

Parameter

value
CodeExpression

Das CodeExpression-Objekt, das in der Auflistung gesucht werden soll.

Gibt zurück

true, wenn die Auflistung das angegebene Objekt enthält, andernfalls false.

Beispiele

Im folgenden Beispiel wird die Contains -Methode verwendet, um nach dem Vorhandensein eines bestimmten CodeExpression Objekts zu suchen, und ruft den Indexwert ab, an dem es gefunden wurde.

// Tests for the presence of a CodeExpression in the 
// collection, and retrieves its index if it is found.
CodeExpression^ testComment = gcnew CodePrimitiveExpression( true );
int itemIndex = -1;
if ( collection->Contains( testComment ) )
   itemIndex = collection->IndexOf( testComment );
// Tests for the presence of a CodeExpression in the
// collection, and retrieves its index if it is found.
CodeExpression testComment = new CodePrimitiveExpression(true);
int itemIndex = -1;
if( collection.Contains( testComment ) )
    itemIndex = collection.IndexOf( testComment );
' Tests for the presence of a CodeExpression in the 
' collection, and retrieves its index if it is found.
Dim testComment = New CodePrimitiveExpression(True)
Dim itemIndex As Integer = -1
If collection.Contains(testComment) Then
    itemIndex = collection.IndexOf(testComment)
End If

Gilt für:

Weitere Informationen