Uredi

Deli z drugimi prek


ParserErrorCollection.AddRange Method

Definition

Adds ParserError objects to a collection.

Overloads

AddRange(ParserError[])

Adds an array of ParserError objects to the collection.

AddRange(ParserErrorCollection)

Adds the objects in an existing ParserErrorCollection to the collection.

AddRange(ParserError[])

Adds an array of ParserError objects to the collection.

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())

Parameters

value
ParserError[]

An array of type ParserError that specifies the values to add to the collection.

Exceptions

value is null.

Examples

The following code example demonstrates how to add a range of ParserError objects to a ParserErrorCollection object.

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

Remarks

Use the AddRange method to add an array of ParserError objects to the collection. The AddRange method is useful when you create multiple ParserError objects and want to add them to the collection with a single method call. To add individual ParserError objects to the collection, use the Add method.

Applies to

AddRange(ParserErrorCollection)

Adds the objects in an existing ParserErrorCollection to the collection.

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)

Parameters

value
ParserErrorCollection

A ParserErrorCollection containing the ParserError objects to add to the collection.

Exceptions

The ParserError value is null.

Examples

The following code example demonstrates how to add a range of ParserError objects to a ParserErrorCollection object.

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

Remarks

Unlike the Add method, the AddRange method does not have a return value that can be used to determine whether a ParserError object being added is already in the collection. If you need this information, use the Contains method before using AddRange.

Applies to