RuleSettingsCollection.Insert(Int32, RuleSettings) 方法

定義

將指定的 RuleSettings 物件加入集合中指定的索引點。

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

參數

index
Int32

集合中物件的有效索引 RuleSettings

eventSettings
RuleSettings

RuleSettings要插入收藏的物件。

例外狀況

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

範例

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

// Insert an RuleSettings object into the Rules collection property.
healthMonitoringSection.Rules.Insert(1,
    new RuleSettings("All Errors Default2",
        "All Errors", "EventLogProvider"));
' Insert an RuleSettings object into the Rules collection property.
healthMonitoringSection.Rules.Insert(1, _
    new RuleSettings("All Errors Default2", _
        "All Errors", "EventLogProvider"))

備註

如果索引參數等於集合中的項目數量,則該條目會附加在集合的末尾。

適用於

另請參閱