ServiceDescriptionCollection.Contains(ServiceDescription) Метод

Определение

Возвращает значение, которое указывает, является ли заданный объект ServiceDescription членом этой коллекции.

public:
 bool Contains(System::Web::Services::Description::ServiceDescription ^ serviceDescription);
public bool Contains (System.Web.Services.Description.ServiceDescription serviceDescription);
member this.Contains : System.Web.Services.Description.ServiceDescription -> bool
Public Function Contains (serviceDescription As ServiceDescription) As Boolean

Параметры

serviceDescription
ServiceDescription

Объект ServiceDescription, для которого требуется проверить членство в коллекции.

Возвращаемое значение

Boolean

Значение true, если параметр serviceDescription является членом коллекции ServiceDescriptionCollection; в противном случае – значение false.

Примеры

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

Применяется к