Прочетете на английски Редактиране

Споделяне чрез


CodeExpressionCollection.AddRange Method

Definition

Copies the elements of the specified array to the end of the collection.

Overloads

AddRange(CodeExpression[])

Copies the elements of the specified array to the end of the collection.

AddRange(CodeExpressionCollection)

Copies the contents of another CodeExpressionCollection object to the end of the collection.

AddRange(CodeExpression[])

Source:
CodeExpressionCollection.cs
Source:
CodeExpressionCollection.cs
Source:
CodeExpressionCollection.cs
Source:
CodeExpressionCollection.cs

Copies the elements of the specified array to the end of the collection.

C#
public void AddRange (System.CodeDom.CodeExpression[] value);

Parameters

value
CodeExpression[]

An array of type CodeExpression that contains the objects to add to the collection.

Exceptions

value is null.

Examples

The following example demonstrates how to use the AddRange(CodeExpression[]) method overload to add the members of a CodeExpression array to a CodeExpressionCollection.

C#
// Adds an array of CodeExpression objects to the collection.
CodeExpression[] expressions = { new CodePrimitiveExpression(true), new CodePrimitiveExpression(true) };
collection.AddRange( expressions );

// Adds a collection of CodeExpression objects to the collection.
CodeExpressionCollection expressionsCollection = new CodeExpressionCollection();
expressionsCollection.Add( new CodePrimitiveExpression(true) );
expressionsCollection.Add( new CodePrimitiveExpression(true) );
collection.AddRange( expressionsCollection );

See also

Applies to

.NET 9 (package-provided) и други версии
Продукт Версии
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

AddRange(CodeExpressionCollection)

Source:
CodeExpressionCollection.cs
Source:
CodeExpressionCollection.cs
Source:
CodeExpressionCollection.cs
Source:
CodeExpressionCollection.cs

Copies the contents of another CodeExpressionCollection object to the end of the collection.

C#
public void AddRange (System.CodeDom.CodeExpressionCollection value);

Parameters

value
CodeExpressionCollection

A CodeExpressionCollection that contains the objects to add to the collection.

Exceptions

value is null.

Examples

The following example demonstrates how to use the AddRange(CodeExpressionCollection) method overload to add the members of one CodeExpressionCollection object to another CodeExpressionCollection.

C#
// Adds an array of CodeExpression objects to the collection.
CodeExpression[] expressions = { new CodePrimitiveExpression(true), new CodePrimitiveExpression(true) };
collection.AddRange( expressions );

// Adds a collection of CodeExpression objects to the collection.
CodeExpressionCollection expressionsCollection = new CodeExpressionCollection();
expressionsCollection.Add( new CodePrimitiveExpression(true) );
expressionsCollection.Add( new CodePrimitiveExpression(true) );
collection.AddRange( expressionsCollection );

See also

Applies to

.NET 9 (package-provided) и други версии
Продукт Версии
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9