ProfileSettingsCollection.IndexOf(String) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回指定 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"))