AddRange Method (CodeNamespaceCollection)
Collapse the table of content
Expand the table of content

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


Type: System.CodeDom.CodeNamespaceCollection

A CodeNamespaceCollection 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 CodeNamespace objects from one CodeNamespaceCollection to another 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
© 2016 Microsoft