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

返回

Int32

32 位带符号整数。

示例

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

if ( myOperationCollection->Contains( myOperation ) == true )
{
   Console::WriteLine( "The index of the added 'myOperation' operation is : {0}", myOperationCollection->IndexOf( myOperation ) );
}
if(myOperationCollection.Contains(myOperation) == true)
{
   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

适用于