ParserErrorCollection.AddRange Méthode

Définition

Ajoute des ParserError objets à une collection.

Surcharges

Nom Description
AddRange(ParserError[])

Ajoute un tableau d’objets ParserError à la collection.

AddRange(ParserErrorCollection)

Ajoute les objets d’une collection existante ParserErrorCollection .

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 qui spécifie 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 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 d’une collection existante ParserErrorCollection .

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

Contenant ParserErrorCollection les ParserError objets à ajouter à la collection.

Exceptions

La ParserError valeur est 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

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 ajouté est déjà dans la collection. Si vous avez besoin de ces informations, utilisez la méthode avant d’utiliser ContainsAddRange.

S’applique à