CodeNamespaceCollection.AddRange Method (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(
	CodeNamespace[] value


Type: System.CodeDom.CodeNamespace[]

An array of type CodeNamespace that contains the objects to add to the collection.

Exception Condition

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.
CodeNamespace[] namespaces = { new CodeNamespace("TestNamespace1"), new CodeNamespace("TestNamespace2") };
collection.AddRange( namespaces );

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

.NET Framework
Available since 1.1
Return to top