Edit

Share via


CodeNamespaceCollection.AddRange Method

Definition

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

Overloads

AddRange(CodeNamespace[])

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

AddRange(CodeNamespaceCollection)

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

AddRange(CodeNamespace[])

Source:
CodeNamespaceCollection.cs
Source:
CodeNamespaceCollection.cs
Source:
CodeNamespaceCollection.cs
Source:
CodeNamespaceCollection.cs
Source:
CodeNamespaceCollection.cs

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

public void AddRange(System.CodeDom.CodeNamespace[] value);

Parameters

value
CodeNamespace[]

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

Exceptions

value is null.

Examples

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 );

See also

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

AddRange(CodeNamespaceCollection)

Source:
CodeNamespaceCollection.cs
Source:
CodeNamespaceCollection.cs
Source:
CodeNamespaceCollection.cs
Source:
CodeNamespaceCollection.cs
Source:
CodeNamespaceCollection.cs

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

public void AddRange(System.CodeDom.CodeNamespaceCollection value);

Parameters

value
CodeNamespaceCollection

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

Exceptions

value is null.

Examples

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 );

See also

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10