ServiceDescriptionCollection.Contains Method (ServiceDescription)

 

Returns a value indicating whether the specified ServiceDescription is a member of the collection.

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

public bool Contains(
	ServiceDescription serviceDescription
)

Parameters

serviceDescription
Type: System.Web.Services.Description.ServiceDescription

The ServiceDescription for which to check collection membership.

Return Value

Type: System.Boolean

true if the serviceDescription parameter is a member of the ServiceDescriptionCollection; otherwise, 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.");
}

.NET Framework
Available since 1.1
Return to top
Show: