共用方式為


CodeDirectiveCollection.AddRange 方法

定義

將一組 CodeDirective 物件加入至集合中。

多載

AddRange(CodeDirective[])

CodeDirective 物件的陣列加入集合結尾。

AddRange(CodeDirectiveCollection)

將指定的 CodeDirectiveCollection 物件內容加入集合的結尾。

AddRange(CodeDirective[])

來源:
CodeDirectiveCollection.cs
來源:
CodeDirectiveCollection.cs
來源:
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)

來源:
CodeDirectiveCollection.cs
來源:
CodeDirectiveCollection.cs
來源:
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)

適用於