CodeNamespaceCollection::AddRange Method (CodeNamespaceCollection^)

 

Adds the contents of the specified CodeNamespaceCollection object to the end of the collection.

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

public:
void AddRange(
	CodeNamespaceCollection^ value
)

Parameters

value
Type: System.CodeDom::CodeNamespaceCollection^

A CodeNamespaceCollection that contains the objects to add to the collection.

Exception Condition
ArgumentNullException

value is null.

The following example demonstrates how to use the AddRange(CodeNamespaceCollection^) method overload to add CodeNamespace objects from one CodeNamespaceCollection to another CodeNamespaceCollection.

// Adds an array of CodeNamespace objects to the collection.
array<CodeNamespace^>^namespaces = {gcnew CodeNamespace( "TestNamespace1" ),gcnew CodeNamespace( "TestNamespace2" )};
collection->AddRange( namespaces );

// Adds a collection of CodeNamespace objects to the collection.
CodeNamespaceCollection^ namespacesCollection = gcnew CodeNamespaceCollection;
namespacesCollection->Add( gcnew CodeNamespace( "TestNamespace1" ) );
namespacesCollection->Add( gcnew CodeNamespace( "TestNamespace2" ) );
collection->AddRange( namespacesCollection );

.NET Framework
Available since 1.1
Return to top
Show: