RuleSettingsCollection.IndexOf(String) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
尋找集合中具有指定名稱的物件索引 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。