Share via


AuthorizationRuleCollection.IndexOf(AuthorizationRule) 方法

定義

取得指定 AuthorizationRule 物件的集合索引。

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 物件。

傳回

指定的 AuthorizationRule 物件索引。

範例

下列程式碼範例示範如何使用 IndexOf 方法。

// 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)

適用於