RuleSettingsCollection.Insert(Int32, RuleSettings) Metodo

Definizione

Aggiunge l'oggetto RuleSettings specificato al punto dell'indice specificato nell'insieme.

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)

Parametri

index
Int32

Indice valido di un oggetto RuleSettings nell'insieme.

eventSettings
RuleSettings

Oggetto RuleSettings da inserire nella raccolta.

Eccezioni

L'oggetto RuleSettings da aggiungere già esiste nell'insieme, l'indice non è valido o l'insieme è in sola lettura.

Esempio

Nell'esempio di codice riportato di seguito viene illustrato come utilizzare il metodo Insert. Questo esempio di codice fa parte di un esempio più ampio fornito per la HealthMonitoringSection classe .

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

Commenti

Se il parametro index è uguale al numero di elementi nell'insieme, la voce viene aggiunta alla fine della raccolta.

Si applica a

Vedi anche