CodeDirectiveCollection.AddRange 方法

定义

向集合添加一组 CodeDirective 对象。

重载

AddRange(CodeDirective[])

CodeDirective 对象的数组添加到集合的末尾。

AddRange(CodeDirectiveCollection)

将指定 CodeDirectiveCollection 对象的内容添加到集合的末尾。

AddRange(CodeDirective[])

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

CodeDirective 对象的数组添加到集合的末尾。

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

参数

value
CodeDirective[]

要添加到集合中的 CodeDirective 对象的数组。

例外

valuenull

示例

下面的代码示例演示如何使用 AddRange(CodeDirective[]) 方法将 对象的数组 CodeDirective 添加到集合中。 此示例是为 类提供的更大示例的一 CodeDirectiveCollection 部分。

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

另请参阅

适用于

AddRange(CodeDirectiveCollection)

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

将指定 CodeDirectiveCollection 对象的内容添加到集合的末尾。

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)

参数

value
CodeDirectiveCollection

一个 CodeDirectiveCollection 对象,它包含要添加到集合中的 CodeDirective 对象。

例外

valuenull

示例

下面的代码示例演示如何使用 AddRange(CodeDirectiveCollection) 方法将 对象的内容 CodeDirectiveCollection 添加到集合中。 此示例是为 类提供的更大示例的一 CodeDirectiveCollection 部分。

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

适用于