HttpHandlerActionCollection.IndexOf(HttpHandlerAction) 方法

定义

获取指定的 HttpHandlerAction 对象的集合索引。

public:
 int IndexOf(System::Web::Configuration::HttpHandlerAction ^ action);
public int IndexOf (System.Web.Configuration.HttpHandlerAction action);
member this.IndexOf : System.Web.Configuration.HttpHandlerAction -> int
Public Function IndexOf (action As HttpHandlerAction) As Integer

参数

action
HttpHandlerAction

要获取其集合索引的 HttpHandlerAction 对象。

返回

集合索引值。

示例

下面的代码示例演示如何获取 HttpHandlerAction 对象集合索引。


// Get the specified handler's index.
HttpHandlerAction httpHandler2 = new HttpHandlerAction(
"Calculator.custom",
"Samples.Aspnet.SystemWebConfiguration.Calculator, CalculatorHandler",
"GET", true);
int handlerIndex = httpHandlers.IndexOf(httpHandler2);

'Get the specified handler's index.
Dim httpHandler2 As System.Web.Configuration.HttpHandlerAction  = new HttpHandlerAction( _
"Calculator.custom", _
"Samples.Aspnet.SystemWebConfiguration.Calculator, CalculatorHandler", _
"GET", _
true)
Dim handlerIndex As Integer = httpHandlers.IndexOf(httpHandler2)

注解

在使用此方法之前,必须使用正确的名称和类型标识 HttpHandlerAction 对象。 然后,可以使用此对象获取其集合索引。

适用于