Redigera

Dela 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

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

public:
 void AddRange(cli::array <System::CodeDom::CodeNamespace ^> ^ value);
public void AddRange (System.CodeDom.CodeNamespace[] value);
member this.AddRange : System.CodeDom.CodeNamespace[] -> unit
Public Sub AddRange (value As CodeNamespace())

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.
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 );
// 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 );
' Adds an array of CodeNamespace objects to the collection.
Dim namespaces As CodeNamespace() = {New CodeNamespace("TestNamespace1"), New CodeNamespace("TestNamespace2")}
collection.AddRange(namespaces)

' Adds a collection of CodeNamespace objects to the collection.
Dim namespacesCollection As New CodeNamespaceCollection()
namespacesCollection.Add(New CodeNamespace("TestNamespace1"))
namespacesCollection.Add(New CodeNamespace("TestNamespace2"))
collection.AddRange(namespacesCollection)

See also

Applies to

AddRange(CodeNamespaceCollection)

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);
public void AddRange (System.CodeDom.CodeNamespaceCollection value);
member this.AddRange : System.CodeDom.CodeNamespaceCollection -> unit
Public Sub AddRange (value As CodeNamespaceCollection)

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.
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 );
// 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 );
' Adds an array of CodeNamespace objects to the collection.
Dim namespaces As CodeNamespace() = {New CodeNamespace("TestNamespace1"), New CodeNamespace("TestNamespace2")}
collection.AddRange(namespaces)

' Adds a collection of CodeNamespace objects to the collection.
Dim namespacesCollection As New CodeNamespaceCollection()
namespacesCollection.Add(New CodeNamespace("TestNamespace1"))
namespacesCollection.Add(New CodeNamespace("TestNamespace2"))
collection.AddRange(namespacesCollection)

See also

Applies to