CodeCatchClauseCollection::AddRange Method (array<CodeCatchClause^>^)

 

Copies the elements of the specified CodeCatchClause array to the end of the collection.

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

public:
void AddRange(
	array<CodeCatchClause^>^ value
)

Parameters

value
Type: array<System.CodeDom::CodeCatchClause^>^

An array of type CodeCatchClause 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<CodeCatchClause^>^) method overload to add the members of an array of CodeCatchClause objects to the CodeCatchClauseCollection.

// Adds an array of CodeCatchClause objects to the collection.
array<CodeCatchClause^>^clauses = {gcnew CodeCatchClause,gcnew CodeCatchClause};
collection->AddRange( clauses );

// Adds a collection of CodeCatchClause objects to the collection.
CodeCatchClauseCollection^ clausesCollection = gcnew CodeCatchClauseCollection;
clausesCollection->Add( gcnew CodeCatchClause( "e",gcnew CodeTypeReference( System::ArgumentOutOfRangeException::typeid ) ) );
clausesCollection->Add( gcnew CodeCatchClause( "e" ) );
collection->AddRange( clausesCollection );

.NET Framework
Available since 1.1
Return to top
Show: