This documentation is archived and is not being maintained.

OperationMessageCollection.IndexOf Method

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

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

Parameters

operationMessage
The OperationMessage for which to search in the collection.

Return Value

A 32-bit signed integer.

Example

[Visual Basic] 
If myOperationMessageCollection.Contains(myOperationMessage) _
   = True Then
   Dim myIndex As Integer = _
      myOperationMessageCollection.IndexOf(myOperationMessage)
   Console.WriteLine(" The index of the Add operation " & _
       "message in the collection is : " & myIndex.ToString())
End If

[C#] 
if(myOperationMessageCollection.Contains(myOperationMessage) 
   == true )
{
   int myIndex =
      myOperationMessageCollection.IndexOf(myOperationMessage);
   Console.WriteLine(" The index of the Add operation " +
      "message in the collection is : " + myIndex);
}

[C++] 
if(myOperationMessageCollection->Contains(myOperationMessage) 
   == true )
{
   int myIndex =
      myOperationMessageCollection->IndexOf(myOperationMessage);
   Console::WriteLine(S" The index of the Add operation message in the collection is : {0}", __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

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

Show: