CodeAttributeArgumentCollection.AddRange Method (CodeAttributeArgumentCollection)


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

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

public void AddRange(
	CodeAttributeArgumentCollection value


Type: System.CodeDom.CodeAttributeArgumentCollection

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

Exception Condition

value is null.

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

// Adds an array of CodeAttributeArgument objects to the collection.
CodeAttributeArgument[] arguments = { new CodeAttributeArgument(), new CodeAttributeArgument() };
collection.AddRange( arguments );

// Adds a collection of CodeAttributeArgument objects to 
// the collection.
CodeAttributeArgumentCollection argumentsCollection = new CodeAttributeArgumentCollection();
argumentsCollection.Add( new CodeAttributeArgument("TestBooleanArgument", new CodePrimitiveExpression(true)) );
argumentsCollection.Add( new CodeAttributeArgument("TestIntArgument", new CodePrimitiveExpression(1)) );
collection.AddRange( argumentsCollection );

.NET Framework
Available since 1.1
Return to top