ParserErrorCollection.AddRange Méthode

Définition

Ajoute plusieurs objets ParserError à la collection.

Surcharges

AddRange(ParserError[])

Ajoute un tableau d'objets ParserError à la collection.

AddRange(ParserErrorCollection)

Ajoute les objets situés dans un ParserErrorCollection existant à la collection.

AddRange(ParserError[])

Ajoute un tableau d'objets ParserError à la 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())

Paramètres

value
ParserError[]

Tableau de type ParserError spécifiant les valeurs à ajouter à la collection.

Exceptions

value a la valeur null.

Exemples

L’exemple de code suivant montre comment ajouter une plage d’objets ParserError à un ParserErrorCollection objet.

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

Remarques

Utilisez la AddRange méthode pour ajouter un tableau d’objets ParserError à la collection. La AddRange méthode est utile lorsque vous créez plusieurs ParserError objets et que vous souhaitez les ajouter à la collection avec un seul appel de méthode. Pour ajouter des objets individuels ParserError à la collection, utilisez la Add méthode.

S’applique à

AddRange(ParserErrorCollection)

Ajoute les objets situés dans un ParserErrorCollection existant à la 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)

Paramètres

value
ParserErrorCollection

ParserErrorCollection comportant les objets ParserError à ajouter à la collection.

Exceptions

Exemples

L’exemple de code suivant montre comment ajouter une plage d’objets ParserError à un ParserErrorCollection objet.

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

Remarques

Contrairement à la Add méthode, la AddRange méthode n’a pas de valeur de retour qui peut être utilisée pour déterminer si un ParserError objet en cours d’ajout est déjà dans la collection. Si vous avez besoin de ces informations, utilisez la méthode avant d’utiliser Contains AddRange.

S’applique à