AuthorizationRuleCollection.IndexOf(AuthorizationRule) 方法

定义

获取指定的 AuthorizationRule 对象的集合索引。Gets the collection index of the specified AuthorizationRule object.

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

参数

rule
AuthorizationRule

其索引被返回的 AuthorizationRule 对象。The AuthorizationRule object whose index is returned.

返回

Int32

指定的 AuthorizationRule 对象的索引。The index of the specified AuthorizationRule object.

示例

下面的代码示例说明如何使用 IndexOf 方法。The following code example shows how to use the IndexOf method.

// Get the rule collection index.
System.Int32 ruleIndex = 
    authorizationSection.Rules.IndexOf(authorizationRule);
' Get the rule collection index.
  Dim ruleIndex As System.Int32 = _
  authorizationSection.Rules.IndexOf(authorizationRule)

适用于