ProfileSettingsCollection.Insert(Int32, ProfileSettings) 方法

定義

在集合中指定的索引處插入指定的 ProfileSettings 物件。

public:
 void Insert(int index, System::Web::Configuration::ProfileSettings ^ authorizationSettings);
public void Insert(int index, System.Web.Configuration.ProfileSettings authorizationSettings);
member this.Insert : int * System.Web.Configuration.ProfileSettings -> unit
Public Sub Insert (index As Integer, authorizationSettings As ProfileSettings)

參數

index
Int32

集合中物件 ProfileSettings 的索引。

authorizationSettings
ProfileSettings

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

例外狀況

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

範例

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

// Insert an ProfileSettings object into the Profiles collection property.
healthMonitoringSection.Profiles.Insert(1, new ProfileSettings("Default2"));
' Insert an ProfileSettings object into the Profiles collection property.
healthMonitoringSection.Profiles.Insert(1, new ProfileSettings("Default2"))

備註

若參數 index 等於集合中的項目數量,則該條目會附加在集合的末尾。

適用於

另請參閱