RuleSettingsCollection.Contains(String) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
如果集合包含具有指定名稱的 RuleSettings 物件,則會傳回 true
。
public:
bool Contains(System::String ^ name);
public bool Contains (string name);
member this.Contains : string -> bool
Public Function Contains (name As String) As Boolean
參數
- name
- String
集合中 RuleSettings 物件的名稱。
傳回
如果集合包含具有指定名稱的 RuleSettings 物件,則為 true
,否則為 false
。
範例
下列程式碼範例示範如何使用 Contains 方法。 此程式碼範例是提供給 類別之較大範例的 HealthMonitoringSection 一部分。
// See if the Rules collection property contains the RuleSettings 'All Errors Default'.
Console.WriteLine("EventMappings contains 'All Errors Default': {0}.",
healthMonitoringSection.Rules.Contains("All Errors Default"));
' See if the Rules collection property contains the RuleSettings 'All Errors Default'.
Console.WriteLine("EventMappings contains 'All Errors Default': {0}.", _
healthMonitoringSection.Rules.Contains("All Errors Default"))
備註
如果指定的名稱不存在,則傳 false
回 。