ProfileSettingsCollection.IndexOf(String) メソッド

定義

指定した ProfileSettings オブジェクトのインデックスを返します。

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

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

返品

指定した ProfileSettings オブジェクトのインデックス。オブジェクトがコレクション内に見つからない場合は -1。

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

// Get the index of the 'Default' ProfileSettings in the Profiles collection property.
Console.WriteLine("Profiles index for 'Default': {0}.",
    healthMonitoringSection.Profiles.IndexOf("Default"));
' Get the index of the 'Default' ProfileSettings in the Profiles collection property.
Console.WriteLine("Profiles index for 'Default': {0}.", _
    healthMonitoringSection.Profiles.IndexOf("Default"))

適用対象

こちらもご覧ください