RuleSettingsCollection.IndexOf(String) メソッド

定義

指定した名前のコレクション内の RuleSettings オブジェクトのインデックスを検索します。

public:
 int IndexOf(System::String ^ name);
public int IndexOf(string name);
member this.IndexOf : string -> int
Public Function IndexOf (name As String) As Integer

パラメーター

name
String

コレクション内の RuleSettings オブジェクトの名前。

返品

指定した名前を持つコレクション内の RuleSettings オブジェクトのインデックス。

次のコード例は、 IndexOf メソッドの使用方法を示しています。 このコード例は、 HealthMonitoringSection クラスに提供されるより大きな例の一部です。

// Get the index of the 'All Errors Default' RuleSettings in the Rules collection property.
Console.WriteLine("EventMappings index for 'All Errors Default': {0}.",
    healthMonitoringSection.Rules.IndexOf("All Errors Default"));
' Get the index of the 'All Errors Default' RuleSettings in the Rules collection property.
Console.WriteLine("EventMappings index for 'All Errors Default': {0}.", _
    healthMonitoringSection.Rules.IndexOf("All Errors Default"))

注釈

指定した名前の RuleSettings オブジェクトがコレクション内にない場合は、-1 を返します。

適用対象

こちらもご覧ください