ParserErrorCollection.AddRange Método

Definição

Adiciona ParserError objetos a uma coleção.

Sobrecargas

Name Description
AddRange(ParserError[])

Adiciona um array de ParserError objetos à coleção.

AddRange(ParserErrorCollection)

Adiciona os objetos de um existente ParserErrorCollection à coleção.

AddRange(ParserError[])

Adiciona um array de ParserError objetos à coleção.

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

Parâmetros

value
ParserError[]

Um array de tipos ParserError que especifica os valores a adicionar à coleção.

Exceções

value é null.

Exemplos

O exemplo de código seguinte demonstra como adicionar um conjunto de ParserError objetos a um ParserErrorCollection objeto.

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

Observações

Use o AddRange método para adicionar um array de ParserError objetos à coleção. O AddRange método é útil quando crias múltiplos ParserError objetos e queres adicioná-los à coleção com uma única chamada de método. Para adicionar objetos individuais ParserError à coleção, use o Add método.

Aplica-se a

AddRange(ParserErrorCollection)

Adiciona os objetos de um existente ParserErrorCollection à coleção.

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)

Parâmetros

value
ParserErrorCollection

A contendo ParserErrorCollection os ParserError objetos a adicionar à coleção.

Exceções

Exemplos

O exemplo de código seguinte demonstra como adicionar um conjunto de ParserError objetos a um ParserErrorCollection objeto.

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

Observações

Ao contrário do Add método, este AddRange não tem um valor de retorno que possa ser usado para determinar se um ParserError objeto a ser adicionado já está na coleção. Se precisar desta informação, use o Contains método antes de usar AddRange.

Aplica-se a