ParserErrorCollection.AddRange Methode

Definition

Fügt einer Auflistung ParserError-Objekte hinzu.

Überlädt

AddRange(ParserError[])

Fügt der Auflistung ein Array von ParserError-Objekten hinzu.

AddRange(ParserErrorCollection)

Fügt der Auflistung die Objekte in einer vorhandenen ParserErrorCollection hinzu.

AddRange(ParserError[])

Fügt der Auflistung ein Array von ParserError-Objekten hinzu.

public:
 void AddRange(cli::array <System::Web::ParserError ^> ^ value);
public void AddRange (System.Web.ParserError[] value);
member this.AddRange : System.Web.ParserError[] -> unit
Public Sub AddRange (value As ParserError())

Parameter

value
ParserError[]

Ein Array vom Typ ParserError, das die Werte angibt, die der Auflistung hinzugefügt werden sollen.

Ausnahmen

value ist null.

Beispiele

Im folgenden Codebeispiel wird veranschaulicht, wie Sie einem ParserErrorCollection Objekt einen Bereich von ParserError Objekten hinzufügen.

// Add an array of ParserError objects to the collection.
ParserError[] errors = 
    { new ParserError("Error 2", "Path", 1), 
    new ParserError("Error 3", "Path", 1) };
collection.AddRange(errors);

// Add a collection of ParserError objects to the collection.
ParserErrorCollection errorsCollection = new ParserErrorCollection();
errorsCollection.Add(new ParserError("Error", "Path", 1));
errorsCollection.Add(new ParserError("Error", "Path", 1));
collection.AddRange(errorsCollection);
' Add an array of ParserError objects to the collection.
Dim errors As ParserError() = _
    {New ParserError("Error 2", "Path", 1), _
    New ParserError("Error 3", "Path", 1)}
collection.AddRange(errors)

' Ads a collection of ParserError objects to the collection.
Dim errorsCollection As New ParserErrorCollection()
errorsCollection.Add(New ParserError("Error", "Path", 1))
errorsCollection.Add(New ParserError("Error", "Path", 1))
collection.AddRange(errorsCollection)

Hinweise

Verwenden Sie die AddRange Methode, um der Auflistung ein Array von ParserError Objekten hinzuzufügen. Die AddRange Methode ist nützlich, wenn Sie mehrere ParserError Objekte erstellen und sie der Auflistung mit einem einzigen Methodenaufruf hinzufügen möchten. Verwenden Sie die Add Methode, um der Auflistung einzelne ParserError Objekte hinzuzufügen.

Gilt für

AddRange(ParserErrorCollection)

Fügt der Auflistung die Objekte in einer vorhandenen ParserErrorCollection hinzu.

public:
 void AddRange(System::Web::ParserErrorCollection ^ value);
public void AddRange (System.Web.ParserErrorCollection value);
member this.AddRange : System.Web.ParserErrorCollection -> unit
Public Sub AddRange (value As ParserErrorCollection)

Parameter

value
ParserErrorCollection

Eine ParserErrorCollection mit den ParserError-Objekten, die der Auflistung hinzugefügt werden sollen.

Ausnahmen

Der ParserError-Wert ist null.

Beispiele

Im folgenden Codebeispiel wird veranschaulicht, wie Sie einem ParserErrorCollection Objekt einen Bereich von ParserError Objekten hinzufügen.

// Add an array of ParserError objects to the collection.
ParserError[] errors = 
    { new ParserError("Error 2", "Path", 1), 
    new ParserError("Error 3", "Path", 1) };
collection.AddRange(errors);

// Add a collection of ParserError objects to the collection.
ParserErrorCollection errorsCollection = new ParserErrorCollection();
errorsCollection.Add(new ParserError("Error", "Path", 1));
errorsCollection.Add(new ParserError("Error", "Path", 1));
collection.AddRange(errorsCollection);
' Add an array of ParserError objects to the collection.
Dim errors As ParserError() = _
    {New ParserError("Error 2", "Path", 1), _
    New ParserError("Error 3", "Path", 1)}
collection.AddRange(errors)

' Ads a collection of ParserError objects to the collection.
Dim errorsCollection As New ParserErrorCollection()
errorsCollection.Add(New ParserError("Error", "Path", 1))
errorsCollection.Add(New ParserError("Error", "Path", 1))
collection.AddRange(errorsCollection)

Hinweise

Im Gegensatz zur Methode verfügt die AddRange Methode nicht über einen Rückgabewert, der Add verwendet werden kann, um zu bestimmen, ob ein ParserError hinzugefügtes Objekt bereits in der Auflistung enthalten ist. Wenn Sie diese Informationen benötigen, verwenden Sie die Contains Methode vor der Verwendung AddRange.

Gilt für