Freigeben über


CodeNamespaceCollection.Contains-Methode

Ruft einen Wert ab, der angibt, ob die Auflistung den angegebenen CodeNamespace enthält.

Namespace: System.CodeDom
Assembly: System (in system.dll)

Syntax

'Declaration
Public Function Contains ( _
    value As CodeNamespace _
) As Boolean
'Usage
Dim instance As CodeNamespaceCollection
Dim value As CodeNamespace
Dim returnValue As Boolean

returnValue = instance.Contains(value)
public bool Contains (
    CodeNamespace value
)
public:
bool Contains (
    CodeNamespace^ value
)
public boolean Contains (
    CodeNamespace value
)
public function Contains (
    value : CodeNamespace
) : boolean

Parameter

  • value
    Der CodeNamespace, der in der Auflistung gesucht werden soll.

Rückgabewert

true, wenn CodeNamespace in der Auflistung enthalten ist, andernfalls false.

Beispiel

' 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
// 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.
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);
}

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

CodeNamespaceCollection-Klasse
CodeNamespaceCollection-Member
System.CodeDom-Namespace
IndexOf