共用方式為


ProfileSettingsCollection.Contains(String) 方法

定義

指出集合是否包含具有指定名稱的 ProfileSettings 物件。

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

集合中 ProfileSettings 物件的名稱。

傳回

Boolean

如果集合包含具有指定 nameProfileSettings 物件為,則為 true,否則為 false

範例

下列程式碼範例示範如何使用 Contains 方法。 此程式碼範例是提供給 類別之較大範例的 HealthMonitoringSection 一部分。

// See if the ProfileSettings collection property contains the event 'Default'.
Console.WriteLine("Profiles contains 'Default': {0}.",
    healthMonitoringSection.Profiles.Contains("Default"));
' See if the ProfileSettings collection property contains the event 'Default'.
Console.WriteLine("Profiles contains 'Default': {0}.", _
    healthMonitoringSection.Profiles.Contains("Default"))

適用於

另請參閱