Bagikan melalui


CodeStatementCollection.Contains(CodeStatement) Metode

Definisi

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

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

Parameter

value
CodeStatement

Objek CodeStatement yang akan dicari dalam koleksi.

Mengembalikan

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

Contoh

Contoh berikut menggunakan Contains metode untuk mencari keberadaan tertentu CodeStatement dan mengambil nilai indeks tempatnya ditemukan.

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

Berlaku untuk

Lihat juga