CodeAttributeArgumentCollection.AddRange Method (CodeAttributeArgument[])


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

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

public void AddRange(
	CodeAttributeArgument[] value


Type: System.CodeDom.CodeAttributeArgument[]

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

Exception Condition

value is null.

The following example demonstrates how to use the AddRange(CodeAttributeArgument[]) method overload to add the members of a CodeAttributeArgument array to a 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