Sdílet prostřednictvím


CodeStatementCollection.AddRange Metoda

Definice

Přidá do kolekce sadu CodeStatement objektů.

Přetížení

AddRange(CodeStatement[])

Přidá do kolekce sadu CodeStatement objektů.

AddRange(CodeStatementCollection)

Přidá obsah jiného CodeStatementCollection objektu na konec kolekce.

AddRange(CodeStatement[])

Zdroj:
CodeStatementCollection.cs
Zdroj:
CodeStatementCollection.cs
Zdroj:
CodeStatementCollection.cs

Přidá do kolekce sadu CodeStatement objektů.

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

Parametry

value
CodeStatement[]

Pole CodeStatement objektů, které se mají přidat do kolekce.

Výjimky

value je null.

Příklady

Následující příklad ukazuje, jak použít AddRange(CodeStatement[]) přetížení metody k přidání členů pole do CodeStatementCollection instance.

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

Viz také

Platí pro

AddRange(CodeStatementCollection)

Zdroj:
CodeStatementCollection.cs
Zdroj:
CodeStatementCollection.cs
Zdroj:
CodeStatementCollection.cs

Přidá obsah jiného CodeStatementCollection objektu na konec kolekce.

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)

Parametry

value
CodeStatementCollection

Objekt CodeStatementCollection , který obsahuje objekty, které chcete přidat do kolekce.

Výjimky

value je null.

Příklady

Následující příklad ukazuje, jak použít AddRange(CodeStatementCollection) přetížení metody k přidání členů jednoho CodeStatementCollection do druhého.

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

Viz také

Platí pro