Share via


ParserErrorCollection.AddRange Método

Definição

Adiciona objetos ParserError a uma coleção.

Sobrecargas

AddRange(ParserError[])

Adiciona uma matriz de objetos ParserError à coleção.

AddRange(ParserErrorCollection)

Adiciona os objetos em ParserErrorCollection existente à coleção.

AddRange(ParserError[])

Adiciona uma matriz de objetos ParserError à 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[]

Uma matriz do tipo ParserError que especifica os valores a serem adicionados à coleção.

Exceções

value é null.

Exemplos

O exemplo de código a seguir demonstra como adicionar um intervalo 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)

Comentários

Use o AddRange método para adicionar uma matriz de ParserError objetos à coleção. O AddRange método é útil quando você cria vários ParserError objetos e deseja 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 em ParserErrorCollection existente à 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

Um ParserErrorCollection que contém os objetos ParserError a adicionar à coleção.

Exceções

Exemplos

O exemplo de código a seguir demonstra como adicionar um intervalo 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)

Comentários

Ao contrário do Add método, o AddRange método não tem um valor retornado que possa ser usado para determinar se um ParserError objeto que está sendo adicionado já está na coleção. Se você precisar dessas informações, use o Contains método antes de usar AddRange.

Aplica-se a