This documentation is archived and is not being maintained.

ServiceDescriptionCollection.IndexOf Method

Searches for the specified ServiceDescription and returns the zero-based index of the first occurrence within the collection.

[Visual Basic]
Public Function IndexOf( _
   ByVal serviceDescription As ServiceDescription _
) As Integer
[C#]
public int IndexOf(
 ServiceDescription serviceDescription
);
[C++]
public: int IndexOf(
 ServiceDescription* serviceDescription
);
[JScript]
public function IndexOf(
   serviceDescription : ServiceDescription
) : int;

Parameters

serviceDescription
The ServiceDescription for which to search in the collection.

Return Value

A 32-bit signed integer.

Example

[Visual Basic] 
' Get the index of a ServiceDescription.
Dim myIndex As Integer = myCollection.IndexOf(myServiceDescription2)

' Remove a ServiceDescription from the collection.
myCollection.Remove(myServiceDescription2)
Console.WriteLine("Element at index {0} is removed.", _
   myIndex.ToString())

[C#] 
// 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.", myIndex);

[C++] 
// Get the index of 'ServiceDescription' object.
int myIndex = myCollection->IndexOf(myServiceDescription2);
// Remove 'ServiceDescription' object from the collection.
myCollection->Remove(myServiceDescription2);
Console::WriteLine(S"Element at index {0} is removed ",__box( myIndex));

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

ServiceDescriptionCollection Class | ServiceDescriptionCollection Members | System.Web.Services.Description Namespace

Show: