Bagikan melalui


CodeCommentStatementCollection.Contains(CodeCommentStatement) Metode

Definisi

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

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

Parameter

value
CodeCommentStatement

untuk CodeCommentStatement mencari dalam koleksi.

Mengembalikan

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

Contoh

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

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

Berlaku untuk

Lihat juga