OperationMessageCollection.IndexOf(OperationMessage) 方法

定义

搜索指定的 OperationMessage 并返回集合中第一个匹配项的从零开始的索引。

public:
 int IndexOf(System::Web::Services::Description::OperationMessage ^ operationMessage);
public int IndexOf(System.Web.Services.Description.OperationMessage operationMessage);
member this.IndexOf : System.Web.Services.Description.OperationMessage -> int
Public Function IndexOf (operationMessage As OperationMessage) As Integer

参数

operationMessage
OperationMessage

集合 OperationMessage 中要搜索的项。

返回

指定操作消息的从零开始的索引,或者在集合中找不到元素时 -1。

示例

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

适用于