CompilerErrorCollection.AddRange Method (CompilerError[])

 

Copies the elements of an array to the end of the error collection.

Namespace:   System.CodeDom.Compiler
Assembly:  System (in System.dll)

public void AddRange(
	CompilerError[] value
)

Parameters

value
Type: System.CodeDom.Compiler.CompilerError[]

An array of type CompilerError that contains the objects to add to the collection.

Exception Condition
ArgumentNullException

value is null.

The following example demonstrates how to use the AddRange(CompilerError[]) method overload to add an array of CompilerError objects to a CompilerErrorCollection.

// Adds an array of CompilerError objects to the collection.
CompilerError[] errors = { new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text"), new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text") };
collection.AddRange( errors );

// Adds a collection of CompilerError objects to the collection.
CompilerErrorCollection errorsCollection = new CompilerErrorCollection();
errorsCollection.Add( new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text") );
errorsCollection.Add( new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text") );
collection.AddRange( errorsCollection );

.NET Framework
Available since 1.1
Return to top
Show: