CodeTypeDeclarationCollection::AddRange Method (CodeTypeDeclarationCollection^)

 

Adds the contents of another CodeTypeDeclarationCollection object to the end of the collection.

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

public:
void AddRange(
	CodeTypeDeclarationCollection^ value
)

Parameters

value
Type: System.CodeDom::CodeTypeDeclarationCollection^

A CodeTypeDeclarationCollection 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(CodeTypeDeclarationCollection^) method overload to add CodeTypeDeclaration objects from one CodeTypeDeclarationCollection to another CodeTypeDeclarationCollection.

// Adds an array of CodeTypeDeclaration objects to the collection.
array<CodeTypeDeclaration^>^declarations = {gcnew CodeTypeDeclaration( "TestType1" ),gcnew CodeTypeDeclaration( "TestType2" )};
collection->AddRange( declarations );

// Adds a collection of CodeTypeDeclaration objects to the 
// collection.
CodeTypeDeclarationCollection^ declarationsCollection = gcnew CodeTypeDeclarationCollection;
declarationsCollection->Add( gcnew CodeTypeDeclaration( "TestType1" ) );
declarationsCollection->Add( gcnew CodeTypeDeclaration( "TestType2" ) );
collection->AddRange( declarationsCollection );

.NET Framework
Available since 1.1
Return to top
Show: