Επεξεργασία

Κοινή χρήση μέσω


CodeDirectiveCollection.AddRange Method

Definition

Adds a set of CodeDirective objects to the collection.

Overloads

AddRange(CodeDirective[])

Adds an array of CodeDirective objects to the end of the collection.

AddRange(CodeDirectiveCollection)

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

AddRange(CodeDirective[])

Source:
CodeDirectiveCollection.cs
Source:
CodeDirectiveCollection.cs
Source:
CodeDirectiveCollection.cs
Source:
CodeDirectiveCollection.cs

Adds an array of CodeDirective objects to the end of the collection.

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

Parameters

value
CodeDirective[]

An array of CodeDirective objects to add to the collection.

Exceptions

value is null.

Examples

The following code example shows the use of the AddRange(CodeDirective[]) method to add an array of CodeDirective objects to the collection. This example is part of a larger example provided for the CodeDirectiveCollection class.

// Adds an array of CodeDirective objects to the collection.
CodeDirective[] directives = {
    new CodeRegionDirective(CodeRegionMode.Start,"Region1"),
    new CodeRegionDirective(CodeRegionMode.End,"Region1") };
collection.AddRange(directives);

// Adds a collection of CodeDirective objects to the collection.
CodeDirectiveCollection directivesCollection = new CodeDirectiveCollection();
directivesCollection.Add(new CodeRegionDirective(CodeRegionMode.Start, "Region2"));
directivesCollection.Add(new CodeRegionDirective(CodeRegionMode.End, "Region2"));
collection.AddRange(directivesCollection);
' Adds an array of CodeDirective objects to the collection.
Dim directives As CodeDirective() = {New CodeRegionDirective(CodeRegionMode.Start, "Region1"), New CodeRegionDirective(CodeRegionMode.End, "Region1")}
collection.AddRange(directives)

' Adds a collection of CodeDirective objects to the collection.
Dim directivesCollection As New CodeDirectiveCollection()
directivesCollection.Add(New CodeRegionDirective(CodeRegionMode.Start, "Region2"))
directivesCollection.Add(New CodeRegionDirective(CodeRegionMode.End, "Region2"))
collection.AddRange(directivesCollection)

See also

Applies to

AddRange(CodeDirectiveCollection)

Source:
CodeDirectiveCollection.cs
Source:
CodeDirectiveCollection.cs
Source:
CodeDirectiveCollection.cs
Source:
CodeDirectiveCollection.cs

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

public:
 void AddRange(System::CodeDom::CodeDirectiveCollection ^ value);
public void AddRange (System.CodeDom.CodeDirectiveCollection value);
member this.AddRange : System.CodeDom.CodeDirectiveCollection -> unit
Public Sub AddRange (value As CodeDirectiveCollection)

Parameters

value
CodeDirectiveCollection

A CodeDirectiveCollection object containing the CodeDirective objects to add to the collection.

Exceptions

value is null.

Examples

The following code example shows the use of the AddRange(CodeDirectiveCollection) method to add the contents of a CodeDirectiveCollection object to the collection. This example is part of a larger example provided for the CodeDirectiveCollection class.

// Adds an array of CodeDirective objects to the collection.
CodeDirective[] directives = {
    new CodeRegionDirective(CodeRegionMode.Start,"Region1"),
    new CodeRegionDirective(CodeRegionMode.End,"Region1") };
collection.AddRange(directives);

// Adds a collection of CodeDirective objects to the collection.
CodeDirectiveCollection directivesCollection = new CodeDirectiveCollection();
directivesCollection.Add(new CodeRegionDirective(CodeRegionMode.Start, "Region2"));
directivesCollection.Add(new CodeRegionDirective(CodeRegionMode.End, "Region2"));
collection.AddRange(directivesCollection);
' Adds an array of CodeDirective objects to the collection.
Dim directives As CodeDirective() = {New CodeRegionDirective(CodeRegionMode.Start, "Region1"), New CodeRegionDirective(CodeRegionMode.End, "Region1")}
collection.AddRange(directives)

' Adds a collection of CodeDirective objects to the collection.
Dim directivesCollection As New CodeDirectiveCollection()
directivesCollection.Add(New CodeRegionDirective(CodeRegionMode.Start, "Region2"))
directivesCollection.Add(New CodeRegionDirective(CodeRegionMode.End, "Region2"))
collection.AddRange(directivesCollection)

Applies to