CodeNamespaceCollection.Contains(CodeNamespace) Methode

Definition

Ruft einen Wert ab, der angibt, ob die Auflistung das angegebene CodeNamespace Objekt enthält.

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

Der CodeNamespace suchte in der Sammlung.

Gibt zurück

truewenn die CodeNamespace In der Auflistung enthalten ist; andernfalls . false

Beispiele

Im folgenden Beispiel wird die Contains Methode verwendet, um ein CodeNamespace Objekt in einem CodeNamespaceCollection.

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

Gilt für:

Weitere Informationen