Bagikan melalui


CodeExpressionCollection.Contains(CodeExpression) Metode

Definisi

Mendapatkan nilai yang menunjukkan apakah koleksi berisi objek yang ditentukan CodeExpression .

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

Objek CodeExpression yang akan ditemukan dalam koleksi.

Mengembalikan

true jika koleksi berisi objek yang ditentukan; jika tidak, false.

Contoh

Contoh berikut menggunakan Contains metode untuk mencari keberadaan objek tertentu CodeExpression dan mendapatkan nilai indeks tempatnya ditemukan.

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

Berlaku untuk

Lihat juga