Sdílet prostřednictvím


RuleSettingsCollection.Insert(Int32, RuleSettings) Metoda

Definice

Přidá zadaný RuleSettings objekt do zadaného bodu indexu v kolekci.

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)

Parametry

index
Int32

Platný index RuleSettings objektu v kolekci.

eventSettings
RuleSettings

Objekt RuleSettings , který chcete vložit do kolekce.

Výjimky

Objekt RuleSettings , který chcete přidat, již v kolekci existuje, index je neplatný nebo kolekce je jen pro čtení.

Příklady

Následující příklad kódu ukazuje, jak použít metodu Insert . Tento příklad kódu je součástí většího příkladu poskytnutého HealthMonitoringSection pro třídu.

// 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"))

Poznámky

Pokud se parametr indexu rovná počtu položek v kolekci, je položka připojena ke konci kolekce.

Platí pro

Viz také