Szerkesztés

Megosztás a következőn keresztül:


CodeAttributeArgumentCollection.AddRange Method

Definition

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

Overloads

AddRange(CodeAttributeArgument[])

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

AddRange(CodeAttributeArgumentCollection)

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

AddRange(CodeAttributeArgument[])

Source:
CodeAttributeArgumentCollection.cs
Source:
CodeAttributeArgumentCollection.cs

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

public:
 void AddRange(cli::array <System::CodeDom::CodeAttributeArgument ^> ^ value);
public void AddRange (System.CodeDom.CodeAttributeArgument[] value);
member this.AddRange : System.CodeDom.CodeAttributeArgument[] -> unit
Public Sub AddRange (value As CodeAttributeArgument())

Parameters

value
CodeAttributeArgument[]

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

Exceptions

value is null.

Examples

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.
array<CodeAttributeArgument^>^arguments = {gcnew CodeAttributeArgument,gcnew CodeAttributeArgument};
collection->AddRange( arguments );

// Adds a collection of CodeAttributeArgument objects to 
// the collection.
CodeAttributeArgumentCollection^ argumentsCollection = gcnew CodeAttributeArgumentCollection;
argumentsCollection->Add( gcnew CodeAttributeArgument( "TestBooleanArgument",gcnew CodePrimitiveExpression( true ) ) );
argumentsCollection->Add( gcnew CodeAttributeArgument( "TestIntArgument",gcnew CodePrimitiveExpression( 1 ) ) );
collection->AddRange( argumentsCollection );
// 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 );
' Adds an array of CodeAttributeArgument objects to the collection.
Dim arguments As CodeAttributeArgument() = {New CodeAttributeArgument(), New CodeAttributeArgument()}
collection.AddRange(arguments)

' Adds a collection of CodeAttributeArgument objects to the collection.
Dim argumentsCollection As New CodeAttributeArgumentCollection()
argumentsCollection.Add(New CodeAttributeArgument("TestBooleanArgument", New CodePrimitiveExpression(True)))
argumentsCollection.Add(New CodeAttributeArgument("TestIntArgument", New CodePrimitiveExpression(1)))
collection.AddRange(argumentsCollection)

See also

Applies to

AddRange(CodeAttributeArgumentCollection)

Source:
CodeAttributeArgumentCollection.cs
Source:
CodeAttributeArgumentCollection.cs

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

public:
 void AddRange(System::CodeDom::CodeAttributeArgumentCollection ^ value);
public void AddRange (System.CodeDom.CodeAttributeArgumentCollection value);
member this.AddRange : System.CodeDom.CodeAttributeArgumentCollection -> unit
Public Sub AddRange (value As CodeAttributeArgumentCollection)

Parameters

value
CodeAttributeArgumentCollection

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

Exceptions

value is null.

Examples

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.
array<CodeAttributeArgument^>^arguments = {gcnew CodeAttributeArgument,gcnew CodeAttributeArgument};
collection->AddRange( arguments );

// Adds a collection of CodeAttributeArgument objects to 
// the collection.
CodeAttributeArgumentCollection^ argumentsCollection = gcnew CodeAttributeArgumentCollection;
argumentsCollection->Add( gcnew CodeAttributeArgument( "TestBooleanArgument",gcnew CodePrimitiveExpression( true ) ) );
argumentsCollection->Add( gcnew CodeAttributeArgument( "TestIntArgument",gcnew CodePrimitiveExpression( 1 ) ) );
collection->AddRange( argumentsCollection );
// 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 );
' Adds an array of CodeAttributeArgument objects to the collection.
Dim arguments As CodeAttributeArgument() = {New CodeAttributeArgument(), New CodeAttributeArgument()}
collection.AddRange(arguments)

' Adds a collection of CodeAttributeArgument objects to the collection.
Dim argumentsCollection As New CodeAttributeArgumentCollection()
argumentsCollection.Add(New CodeAttributeArgument("TestBooleanArgument", New CodePrimitiveExpression(True)))
argumentsCollection.Add(New CodeAttributeArgument("TestIntArgument", New CodePrimitiveExpression(1)))
collection.AddRange(argumentsCollection)

See also

Applies to