ProfileSettingsCollection.Insert(Int32, ProfileSettings) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將指定的 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
如果 參數等於集合中的專案數,則會將專案附加至集合的結尾。