CompilerErrorCollection::AddRange Method (array<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(
	array<CompilerError^>^ value
)

Parameters

value
Type: array<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(array<CompilerError^>^) method overload to add an array of CompilerError objects to a CompilerErrorCollection.

// Adds an array of CompilerError objects to the collection.
array<CompilerError^>^errors = {gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" ),gcnew CompilerError( "Testfile::cs",5,10,"CS0001","Example error text" )};
collection->AddRange( errors );

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

.NET Framework
Available since 1.1
Return to top
Show: