CodeAttributeArgumentCollection.AddRange 方法

定义

将指定的 CodeAttributeArgument 数组的元素复制到集合末尾。Copies the elements of the specified CodeAttributeArgument array to the end of the collection.

重载

AddRange(CodeAttributeArgument[])

将指定的 CodeAttributeArgument 数组的元素复制到集合末尾。Copies the elements of the specified CodeAttributeArgument array to the end of the collection.

AddRange(CodeAttributeArgumentCollection)

将另一个 CodeAttributeArgumentCollection 对象的内容复制到集合的末尾。Copies the contents of another CodeAttributeArgumentCollection object to the end of the collection.

AddRange(CodeAttributeArgument[])

将指定的 CodeAttributeArgument 数组的元素复制到集合末尾。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())

参数

value
CodeAttributeArgument[]

CodeAttributeArgument 类型的数组,其中包含要添加到集合中的对象。An array of type CodeAttributeArgument that contains the objects to add to the collection.

例外

valuenullvalue is null.

示例

下面的示例演示如何使用 AddRange(CodeAttributeArgument[]) 方法重载将数组的成员添加 CodeAttributeArgumentCodeAttributeArgumentCollectionThe 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)

另请参阅

AddRange(CodeAttributeArgumentCollection)

将另一个 CodeAttributeArgumentCollection 对象的内容复制到集合的末尾。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)

参数

value
CodeAttributeArgumentCollection

一个 CodeAttributeArgumentCollection,其中包含要添加到集合中的对象。A CodeAttributeArgumentCollection that contains the objects to add to the collection.

例外

valuenullvalue is null.

示例

下面的示例演示如何使用 AddRange(CodeAttributeArgumentCollection) 方法重载将一个对象的成员添加 CodeAttributeArgumentCollection 到另一个对象 CodeAttributeArgumentCollectionThe 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)

另请参阅

适用于