CodeNamespaceCollection::AddRange Method (array<CodeNamespace^>^)

 

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

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

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

Parameters

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

An array of type CodeNamespace 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 members of a CodeNamespace array to the 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: