CodeDirectiveCollection.AddRange Method (CodeDirective[])

Adds an array of CodeDirective objects to the end of the collection.

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

public void AddRange(
	CodeDirective[] value
)

Parameters

value
Type: System.CodeDom.CodeDirective[]

An array of CodeDirective objects to add to the collection.

ExceptionCondition
ArgumentNullException

value is null.

The following code example shows the use of the AddRange(CodeDirective[]) method to add an array of CodeDirective objects to the collection. This example is part of a larger example provided for the CodeDirectiveCollection class.

// Adds an array of CodeDirective objects to the collection.
CodeDirective[] directives = { 
    new CodeRegionDirective(CodeRegionMode.Start,"Region1"), 
    new CodeRegionDirective(CodeRegionMode.End,"Region1") };
collection.AddRange(directives);

// Adds a collection of CodeDirective objects to the collection.
CodeDirectiveCollection directivesCollection = new CodeDirectiveCollection();
directivesCollection.Add(new CodeRegionDirective(CodeRegionMode.Start, "Region2"));
directivesCollection.Add(new CodeRegionDirective(CodeRegionMode.End, "Region2"));
collection.AddRange(directivesCollection);

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft