CodeTypeMemberCollection::AddRange Method (CodeTypeMemberCollection^)

 

Adds the contents of another CodeTypeMemberCollection to the end of the collection.

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

public:
void AddRange(
	CodeTypeMemberCollection^ value
)

Parameters

value
Type: System.CodeDom::CodeTypeMemberCollection^

A CodeTypeMemberCollection containing the objects to add to the collection.

Exception Condition
ArgumentNullException

value is null.

The following code 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.
array<CodeTypeMember^>^members = {gcnew CodeMemberField( "System.String","TestStringField1" ),gcnew CodeMemberField( "System.String","TestStringField2" )};
collection->AddRange( members );

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

.NET Framework
Available since 1.1
Return to top
Show: