Share via


CodeStatementCollection.AddRange Methode

Definition

Fügt der Auflistung eine Gruppe von CodeStatement-Objekten hinzu.

Überlädt

AddRange(CodeStatement[])

Fügt der Auflistung eine Gruppe von CodeStatement-Objekten hinzu.

AddRange(CodeStatementCollection)

Fügt den Inhalt eines anderen CodeStatementCollection-Objekts am Ende der Auflistung hinzu.

AddRange(CodeStatement[])

Quelle:
CodeStatementCollection.cs
Quelle:
CodeStatementCollection.cs
Quelle:
CodeStatementCollection.cs

Fügt der Auflistung eine Gruppe von CodeStatement-Objekten hinzu.

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[]

Ein Array von CodeStatement-Objekten, die der Auflistung hinzugefügt werden sollen.

Ausnahmen

value ist null.

Beispiele

Im folgenden Beispiel wird veranschaulicht, wie sie mithilfe der AddRange(CodeStatement[]) Methodenüberladung die Member eines Arrays einem CodeStatementCollection instance hinzufügen.

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

Weitere Informationen

Gilt für:

AddRange(CodeStatementCollection)

Quelle:
CodeStatementCollection.cs
Quelle:
CodeStatementCollection.cs
Quelle:
CodeStatementCollection.cs

Fügt den Inhalt eines anderen CodeStatementCollection-Objekts am Ende der Auflistung hinzu.

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

Ein CodeStatementCollection-Objekt, das die Objekte enthält, die der Auflistung hinzugefügt werden sollen.

Ausnahmen

value ist null.

Beispiele

Im folgenden Beispiel wird veranschaulicht, wie die AddRange(CodeStatementCollection) Methodenüberladung verwendet wird, um die Member eines CodeStatementCollection anderen hinzuzufügen.

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

Weitere Informationen

Gilt für: