CodeStatementCollection.AddRange Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Menambahkan sekumpulan CodeStatement objek ke koleksi.
Overload
AddRange(CodeStatement[]) |
Menambahkan sekumpulan CodeStatement objek ke koleksi. |
AddRange(CodeStatementCollection) |
Menambahkan isi objek lain CodeStatementCollection ke akhir koleksi. |
AddRange(CodeStatement[])
- Sumber:
- CodeStatementCollection.cs
- Sumber:
- CodeStatementCollection.cs
- Sumber:
- CodeStatementCollection.cs
Menambahkan sekumpulan CodeStatement objek ke koleksi.
public:
void AddRange(cli::array <System::CodeDom::CodeStatement ^> ^ value);
public void AddRange (System.CodeDom.CodeStatement[] value);
member this.AddRange : System.CodeDom.CodeStatement[] -> unit
Public Sub AddRange (value As CodeStatement())
Parameter
- value
- CodeStatement[]
Array CodeStatement objek untuk ditambahkan ke koleksi.
Pengecualian
value
adalah null
.
Contoh
Contoh berikut menunjukkan cara menggunakan AddRange(CodeStatement[]) metode kelebihan beban untuk menambahkan anggota array ke CodeStatementCollection instans.
// Adds an array of CodeStatement objects to the collection.
array<CodeStatement^>^statements = {gcnew CodeCommentStatement( "Test comment statement" ),gcnew CodeCommentStatement( "Test comment statement" )};
collection->AddRange( statements );
// Adds a collection of CodeStatement objects to the collection.
CodeStatement^ testStatement = gcnew CodeCommentStatement( "Test comment statement" );
CodeStatementCollection^ statementsCollection = gcnew CodeStatementCollection;
statementsCollection->Add( gcnew CodeCommentStatement( "Test comment statement" ) );
statementsCollection->Add( gcnew CodeCommentStatement( "Test comment statement" ) );
statementsCollection->Add( testStatement );
collection->AddRange( statementsCollection );
// Adds an array of CodeStatement objects to the collection.
CodeStatement[] statements = {
new CodeCommentStatement("Test comment statement"),
new CodeCommentStatement("Test comment statement")};
collection.AddRange( statements );
// Adds a collection of CodeStatement objects to the collection.
CodeStatement testStatement = new CodeCommentStatement("Test comment statement");
CodeStatementCollection statementsCollection = new CodeStatementCollection();
statementsCollection.Add( new CodeCommentStatement("Test comment statement") );
statementsCollection.Add( new CodeCommentStatement("Test comment statement") );
statementsCollection.Add( testStatement );
collection.AddRange( statementsCollection );
' Adds an array of CodeStatement objects to the collection.
Dim statements As CodeStatement() = {New CodeCommentStatement("Test comment statement"), New CodeCommentStatement("Test comment statement")}
collection.AddRange(statements)
' Adds a collection of CodeStatement objects to the collection.
Dim testStatement As New CodeStatement
Dim statementsCollection As New CodeStatementCollection
statementsCollection.Add(New CodeCommentStatement("Test comment statement"))
statementsCollection.Add(New CodeCommentStatement("Test comment statement"))
statementsCollection.Add(testStatement)
collection.AddRange(statementsCollection)
Lihat juga
Berlaku untuk
AddRange(CodeStatementCollection)
- Sumber:
- CodeStatementCollection.cs
- Sumber:
- CodeStatementCollection.cs
- Sumber:
- CodeStatementCollection.cs
Menambahkan isi objek lain CodeStatementCollection ke akhir koleksi.
public:
void AddRange(System::CodeDom::CodeStatementCollection ^ value);
public void AddRange (System.CodeDom.CodeStatementCollection value);
member this.AddRange : System.CodeDom.CodeStatementCollection -> unit
Public Sub AddRange (value As CodeStatementCollection)
Parameter
- value
- CodeStatementCollection
Objek CodeStatementCollection yang berisi objek untuk ditambahkan ke koleksi.
Pengecualian
value
adalah null
.
Contoh
Contoh berikut menunjukkan cara menggunakan AddRange(CodeStatementCollection) metode kelebihan beban untuk menambahkan anggota satu CodeStatementCollection ke yang lain.
// Adds an array of CodeStatement objects to the collection.
array<CodeStatement^>^statements = {gcnew CodeCommentStatement( "Test comment statement" ),gcnew CodeCommentStatement( "Test comment statement" )};
collection->AddRange( statements );
// Adds a collection of CodeStatement objects to the collection.
CodeStatement^ testStatement = gcnew CodeCommentStatement( "Test comment statement" );
CodeStatementCollection^ statementsCollection = gcnew CodeStatementCollection;
statementsCollection->Add( gcnew CodeCommentStatement( "Test comment statement" ) );
statementsCollection->Add( gcnew CodeCommentStatement( "Test comment statement" ) );
statementsCollection->Add( testStatement );
collection->AddRange( statementsCollection );
// Adds an array of CodeStatement objects to the collection.
CodeStatement[] statements = {
new CodeCommentStatement("Test comment statement"),
new CodeCommentStatement("Test comment statement")};
collection.AddRange( statements );
// Adds a collection of CodeStatement objects to the collection.
CodeStatement testStatement = new CodeCommentStatement("Test comment statement");
CodeStatementCollection statementsCollection = new CodeStatementCollection();
statementsCollection.Add( new CodeCommentStatement("Test comment statement") );
statementsCollection.Add( new CodeCommentStatement("Test comment statement") );
statementsCollection.Add( testStatement );
collection.AddRange( statementsCollection );
' Adds an array of CodeStatement objects to the collection.
Dim statements As CodeStatement() = {New CodeCommentStatement("Test comment statement"), New CodeCommentStatement("Test comment statement")}
collection.AddRange(statements)
' Adds a collection of CodeStatement objects to the collection.
Dim testStatement As New CodeStatement
Dim statementsCollection As New CodeStatementCollection
statementsCollection.Add(New CodeCommentStatement("Test comment statement"))
statementsCollection.Add(New CodeCommentStatement("Test comment statement"))
statementsCollection.Add(testStatement)
collection.AddRange(statementsCollection)