ServiceDescriptionCollection.Contains(ServiceDescription) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a value indicating whether the specified ServiceDescription is a member of the collection.
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
Parameters
- serviceDescription
- ServiceDescription
The ServiceDescription for which to check collection membership.
Returns
true
if the serviceDescription
parameter is a member of the ServiceDescriptionCollection; otherwise, false
.
Examples
// 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
Applies to
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
.NET