CodeStatementCollection.AddRange Metod

Definition

Lägger till en uppsättning CodeStatement objekt i samlingen.

Överlagringar

Name Description
AddRange(CodeStatement[])

Lägger till en uppsättning CodeStatement objekt i samlingen.

AddRange(CodeStatementCollection)

Lägger till innehållet i ett annat CodeStatementCollection objekt i slutet av samlingen.

AddRange(CodeStatement[])

Lägger till en uppsättning CodeStatement objekt i samlingen.

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

Parametrar

value
CodeStatement[]

En matris med CodeStatement objekt som ska läggas till i samlingen.

Undantag

value är null.

Exempel

I följande exempel visas hur du använder metodöverbelastningen AddRange(CodeStatement[]) för att lägga till medlemmar i en matris i en CodeStatementCollection instans.

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

Se även

Gäller för

AddRange(CodeStatementCollection)

Lägger till innehållet i ett annat CodeStatementCollection objekt i slutet av samlingen.

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)

Parametrar

value
CodeStatementCollection

Ett CodeStatementCollection objekt som innehåller de objekt som ska läggas till i samlingen.

Undantag

value är null.

Exempel

I följande exempel visas hur du använder metodöverlagringen AddRange(CodeStatementCollection) för att lägga till medlemmar i en CodeStatementCollection annan.

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

Se även

Gäller för