语言

OperationCollection.IndexOf(Operation) 方法

定义

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

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

参数

operation
Operation

集合 Operation 中要搜索的项。

返回

32 位有符号整数。

示例

下面的示例演示 IndexOf 方法的用法。

if ( myOperationCollection->Contains( myOperation ))
{
   Console::WriteLine( "The index of the added 'myOperation' operation is : {0}", myOperationCollection->IndexOf( myOperation ) );
}
if (myOperationCollection.Contains(myOperation))
{
   Console.WriteLine("The index of the added 'myOperation' " +
                     "operation is : " +
                     myOperationCollection.IndexOf(myOperation));
}
If myOperationCollection.Contains(myOperation) = True Then
   Console.WriteLine("The index of the added 'myOperation' " + _
            "operation is : " + _
            myOperationCollection.IndexOf(myOperation).ToString)
End If

适用于