Bagikan melalui


CodeNamespaceCollection.Contains(CodeNamespace) Metode

Definisi

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

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

Parameter

value
CodeNamespace

untuk CodeNamespace mencari dalam koleksi.

Mengembalikan

trueCodeNamespace jika terkandung dalam koleksi; jika tidak, false.

Contoh

Contoh berikut menggunakan Contains metode untuk menemukan CodeNamespace objek dalam CodeNamespaceCollection.

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

Berlaku untuk

Lihat juga