语言

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如果参数等于集合中的项数,则条目将追加到集合的末尾。

适用于

另请参阅