Bagikan melalui


CodeDirectiveCollection.AddRange Metode

Definisi

Menambahkan sekumpulan CodeDirective objek ke koleksi.

Overload

AddRange(CodeDirective[])

Menambahkan array CodeDirective objek ke akhir koleksi.

AddRange(CodeDirectiveCollection)

Menambahkan isi objek yang ditentukan CodeDirectiveCollection ke akhir koleksi.

AddRange(CodeDirective[])

Sumber:
CodeDirectiveCollection.cs
Sumber:
CodeDirectiveCollection.cs
Sumber:
CodeDirectiveCollection.cs

Menambahkan array CodeDirective objek ke akhir koleksi.

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

Parameter

value
CodeDirective[]

Array CodeDirective objek untuk ditambahkan ke koleksi.

Pengecualian

valueadalah null.

Contoh

Contoh kode berikut menunjukkan penggunaan AddRange(CodeDirective[]) metode untuk menambahkan array CodeDirective objek ke koleksi. Contoh ini adalah bagian dari contoh yang lebih besar yang disediakan untuk CodeDirectiveCollection kelas .

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

Lihat juga

Berlaku untuk

AddRange(CodeDirectiveCollection)

Sumber:
CodeDirectiveCollection.cs
Sumber:
CodeDirectiveCollection.cs
Sumber:
CodeDirectiveCollection.cs

Menambahkan isi objek yang ditentukan CodeDirectiveCollection ke akhir koleksi.

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)

Parameter

value
CodeDirectiveCollection

Objek CodeDirectiveCollection yang berisi CodeDirective objek untuk ditambahkan ke koleksi.

Pengecualian

valueadalah null.

Contoh

Contoh kode berikut menunjukkan penggunaan AddRange(CodeDirectiveCollection) metode untuk menambahkan konten CodeDirectiveCollection objek ke koleksi. Contoh ini adalah bagian dari contoh yang lebih besar yang disediakan untuk CodeDirectiveCollection kelas .

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

Berlaku untuk