語言

ProfileSettingsCollection.Add(ProfileSettings) 方法

定義

新增一個 ProfileSettings 物件到集合中。

public:
 void Add(System::Web::Configuration::ProfileSettings ^ profilesSettings);
public void Add(System.Web.Configuration.ProfileSettings profilesSettings);
member this.Add : System.Web.Configuration.ProfileSettings -> unit
Public Sub Add (profilesSettings As ProfileSettings)

參數

profilesSettings
ProfileSettings

一個 ProfileSettings 要加入收藏的物件。

例外狀況

ProfileSettings要新增的物件已經存在於集合中,或是集合是唯讀的。

範例

下列程式代碼範例示範如何使用 Add 方法。 此程式碼範例是本類別更大範例 HealthMonitoringSection 的一部分。


// Get the current Enabled property value.
Boolean enabledValue = healthMonitoringSection.Enabled;

// Set the Enabled property to false.
healthMonitoringSection.Enabled = false;

' Get the current Enabled property value.
Dim enabledValue As Boolean = healthMonitoringSection.Enabled

' Set the Enabled property to False.
healthMonitoringSection.Enabled = False

備註

該集合必須不包含 ProfileSettings 同名的物件。

適用於

另請參閱