CodeExpressionCollection.AddRange Method (CodeExpressionCollection)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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

Namespace:   System.CodeDom
Assembly:  System (in System.dll)

public void AddRange(
	CodeExpressionCollection value


Type: System.CodeDom.CodeExpressionCollection

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

Exception Condition

value is null.

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

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

.NET Framework
Available since 1.1
Return to top