CompilerErrorCollection::AddRange Method (CompilerErrorCollection^)

 

Adds the contents of the specified compiler error collection to the end of the error collection.

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

public:
void AddRange(
	CompilerErrorCollection^ value
)

Parameters

value
Type: System.CodeDom.Compiler::CompilerErrorCollection^

A CompilerErrorCollection object that contains the objects to add to the collection.

Exception Condition
ArgumentNullException

value is null.

The following example demonstrates how to use the AddRange(CompilerErrorCollection^) method overload to add CompilerError objects from one CompilerErrorCollection to another 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: