Share via


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如果 參數等於集合中的專案數,則會將專案附加至集合的結尾。

適用於

另請參閱