CodeTypeMemberCollection.AddRange Method (CodeTypeMember[])


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

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

public void AddRange(
	CodeTypeMember[] value


Type: System.CodeDom.CodeTypeMember[]

An array of type CodeTypeMember containing the objects to add to the collection.

Exception Condition

value is null.

The following example demonstrates how to use the two AddRange method overloads to add the members of an array to a CodeTypeMemberCollection object, and to add the members of one CodeTypeMemberCollection to another.

// Adds an array of CodeTypeMember objects to the collection.
CodeTypeMember[] members = { new CodeMemberField("System.String", "TestStringField1"), new CodeMemberField("System.String", "TestStringField2") };
collection.AddRange( members );

// Adds a collection of CodeTypeMember objects to the collection.
CodeTypeMemberCollection membersCollection = new CodeTypeMemberCollection();
membersCollection.Add( new CodeMemberField("System.String", "TestStringField1") );
membersCollection.Add( new CodeMemberField("System.String", "TestStringField2") );
collection.AddRange( membersCollection );

.NET Framework
Available since 1.1
Return to top