CodeAttributeArgumentCollection.AddRange 方法

定義

將指定 CodeAttributeArgument 陣列的元素複製到集合的末尾。

多載

名稱 Description
AddRange(CodeAttributeArgument[])

將指定 CodeAttributeArgument 陣列的元素複製到集合的末尾。

AddRange(CodeAttributeArgumentCollection)

將另一個 CodeAttributeArgumentCollection 物件的內容複製到集合的末尾。

AddRange(CodeAttributeArgument[])

將指定 CodeAttributeArgument 陣列的元素複製到集合的末尾。

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 為 的陣列,包含要加入集合的物件。

例外狀況

valuenull

範例

以下範例示範如何利用 AddRange(CodeAttributeArgument[]) 方法過載將陣列成員 CodeAttributeArgument 加入 CodeAttributeArgumentCollection

// 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 物件的內容複製到集合的末尾。

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 包含要加入集合的物件。

例外狀況

valuenull

範例

以下範例示範如何利用 AddRange(CodeAttributeArgumentCollection) 方法過載將一個 CodeAttributeArgumentCollection 物件的成員加入另一個 CodeAttributeArgumentCollection物件。

// 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)

另請參閱

適用於