Freigeben über


ServiceDescriptionCollection.Contains-Methode

Gibt einen Wert zurück, der angibt, ob die angegebene ServiceDescription ein Member der Auflistung ist.

Namespace: System.Web.Services.Description
Assembly: System.Web.Services (in system.web.services.dll)

Syntax

'Declaration
Public Function Contains ( _
    serviceDescription As ServiceDescription _
) As Boolean
'Usage
Dim instance As ServiceDescriptionCollection
Dim serviceDescription As ServiceDescription
Dim returnValue As Boolean

returnValue = instance.Contains(serviceDescription)
public bool Contains (
    ServiceDescription serviceDescription
)
public:
bool Contains (
    ServiceDescription^ serviceDescription
)
public boolean Contains (
    ServiceDescription serviceDescription
)
public function Contains (
    serviceDescription : ServiceDescription
) : boolean

Parameter

  • serviceDescription
    Die ServiceDescription, für die überprüft werden soll, ob sie Member der Auflistung ist.

Rückgabewert

true, wenn der serviceDescription-Parameter ein Member der ServiceDescriptionCollection ist, andernfalls false.

Beispiel

' Check for 'ServiceDescription' object in the collection.
If myCollection.Contains(myServiceDescription2) Then
   ' Get the index of 'ServiceDescription' object.
   Dim myIndex As Integer = myCollection.IndexOf(myServiceDescription2)
   ' Remove 'ServiceDescription' object from the collection.
   myCollection.Remove(myServiceDescription2)
   Console.WriteLine("Element at index {0} is removed ", myIndex.ToString())
Else
   Console.WriteLine("Element not found.")
End If
// Check for 'ServiceDescription' object in the collection.
if (myCollection.Contains(myServiceDescription2))
{ 
   // Get the index of 'ServiceDescription' object.
   int myIndex = myCollection.IndexOf(myServiceDescription2); 
   // Remove 'ServiceDescription' object from the collection.
   myCollection.Remove(myServiceDescription2);
   Console.WriteLine("Element at index {0} is removed ", myIndex);
}
else
{
   Console.WriteLine("Element not found.");
}
// Check for 'ServiceDescription' object in the collection.
if (myCollection.Contains(myServiceDescription2)) {
    // Get the index of 'ServiceDescription' object.
    int myIndex = myCollection.IndexOf(myServiceDescription2);
    // Remove 'ServiceDescription' object from the collection.
    myCollection.Remove(myServiceDescription2);
    Console.WriteLine("Element at index {0} is removed ", 
        System.Convert.ToString(myIndex));
}
    
else {
    Console.WriteLine("Element not found.");
}
// Check for a ServiceDescription in the collection.
if (myCollection.Contains(myServiceDescription2)) {
    // Get the index of a ServiceDescription.
    int myIndex = myCollection.IndexOf(myServiceDescription2);
    // Remove a ServiceDescription from the collection.
    myCollection.Remove(myServiceDescription2);
    Console.WriteLine("Element at index {0} is removed.",
        System.Convert.ToString(myIndex));
}
    
else {
    Console.WriteLine("Element not found.");
}

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

ServiceDescriptionCollection-Klasse
ServiceDescriptionCollection-Member
System.Web.Services.Description-Namespace