共用方式為


CodeAttributeDeclarationCollection.AddRange 方法

定義

將指定的 CodeAttributeDeclaration 陣列元素複製到集合的末端。

多載

AddRange(CodeAttributeDeclaration[])

將指定的 CodeAttributeDeclaration 陣列元素複製到集合的末端。

AddRange(CodeAttributeDeclarationCollection)

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

AddRange(CodeAttributeDeclaration[])

來源:
CodeAttributeDeclarationCollection.cs
來源:
CodeAttributeDeclarationCollection.cs
來源:
CodeAttributeDeclarationCollection.cs

將指定的 CodeAttributeDeclaration 陣列元素複製到集合的末端。

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

參數

value
CodeAttributeDeclaration[]

CodeAttributeDeclaration 型別的陣列,包含要加入至集合的物件。

例外狀況

valuenull

範例

下列範例示範如何使用 AddRange(CodeAttributeDeclaration[]) 方法多載,將物件的陣列 CodeAttributeDeclaration 加入 至 CodeAttributeDeclarationCollection

// Adds an array of CodeAttributeDeclaration objects 
// to the collection.
array<CodeAttributeDeclaration^>^declarations = {gcnew CodeAttributeDeclaration,gcnew CodeAttributeDeclaration};
collection->AddRange( declarations );

// Adds a collection of CodeAttributeDeclaration objects 
// to the collection.
CodeAttributeDeclarationCollection^ declarationsCollection = gcnew CodeAttributeDeclarationCollection;
array<CodeAttributeArgument^>^temp1 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )};
declarationsCollection->Add( gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp1 ) );
array<CodeAttributeArgument^>^temp2 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( true ) )};
declarationsCollection->Add( gcnew CodeAttributeDeclaration( "BrowsableAttribute",temp2 ) );
collection->AddRange( declarationsCollection );
// Adds an array of CodeAttributeDeclaration objects
// to the collection.
CodeAttributeDeclaration[] declarations = { new CodeAttributeDeclaration(), new CodeAttributeDeclaration() };
collection.AddRange( declarations );

// Adds a collection of CodeAttributeDeclaration objects
// to the collection.
CodeAttributeDeclarationCollection declarationsCollection = new CodeAttributeDeclarationCollection();
declarationsCollection.Add( new CodeAttributeDeclaration("DescriptionAttribute", new CodeAttributeArgument(new CodePrimitiveExpression("Test Description"))) );
declarationsCollection.Add( new CodeAttributeDeclaration("BrowsableAttribute", new CodeAttributeArgument(new CodePrimitiveExpression(true))) );
collection.AddRange( declarationsCollection );
' Adds an array of CodeAttributeDeclaration objects to the collection.
Dim declarations As CodeAttributeDeclaration() = {New CodeAttributeDeclaration(), New CodeAttributeDeclaration()}
collection.AddRange(declarations)

' Adds a collection of CodeAttributeDeclaration objects to 
' the collection.
Dim declarationsCollection As New CodeAttributeDeclarationCollection()
declarationsCollection.Add(New CodeAttributeDeclaration("DescriptionAttribute", New CodeAttributeArgument(New CodePrimitiveExpression("Test Description"))))
declarationsCollection.Add(New CodeAttributeDeclaration("BrowsableAttribute", New CodeAttributeArgument(New CodePrimitiveExpression(True))))
collection.AddRange(declarationsCollection)

另請參閱

適用於

AddRange(CodeAttributeDeclarationCollection)

來源:
CodeAttributeDeclarationCollection.cs
來源:
CodeAttributeDeclarationCollection.cs
來源:
CodeAttributeDeclarationCollection.cs

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

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

參數

value
CodeAttributeDeclarationCollection

CodeAttributeDeclarationCollection,包含要加入至集合的物件。

例外狀況

valuenull

範例

下列範例示範如何使用 AddRange(CodeAttributeDeclarationCollection) 方法多載,將彼此的成員新增至另一個 CodeAttributeDeclarationCollection

// Adds an array of CodeAttributeDeclaration objects 
// to the collection.
array<CodeAttributeDeclaration^>^declarations = {gcnew CodeAttributeDeclaration,gcnew CodeAttributeDeclaration};
collection->AddRange( declarations );

// Adds a collection of CodeAttributeDeclaration objects 
// to the collection.
CodeAttributeDeclarationCollection^ declarationsCollection = gcnew CodeAttributeDeclarationCollection;
array<CodeAttributeArgument^>^temp1 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )};
declarationsCollection->Add( gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp1 ) );
array<CodeAttributeArgument^>^temp2 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( true ) )};
declarationsCollection->Add( gcnew CodeAttributeDeclaration( "BrowsableAttribute",temp2 ) );
collection->AddRange( declarationsCollection );
// Adds an array of CodeAttributeDeclaration objects
// to the collection.
CodeAttributeDeclaration[] declarations = { new CodeAttributeDeclaration(), new CodeAttributeDeclaration() };
collection.AddRange( declarations );

// Adds a collection of CodeAttributeDeclaration objects
// to the collection.
CodeAttributeDeclarationCollection declarationsCollection = new CodeAttributeDeclarationCollection();
declarationsCollection.Add( new CodeAttributeDeclaration("DescriptionAttribute", new CodeAttributeArgument(new CodePrimitiveExpression("Test Description"))) );
declarationsCollection.Add( new CodeAttributeDeclaration("BrowsableAttribute", new CodeAttributeArgument(new CodePrimitiveExpression(true))) );
collection.AddRange( declarationsCollection );
' Adds an array of CodeAttributeDeclaration objects to the collection.
Dim declarations As CodeAttributeDeclaration() = {New CodeAttributeDeclaration(), New CodeAttributeDeclaration()}
collection.AddRange(declarations)

' Adds a collection of CodeAttributeDeclaration objects to 
' the collection.
Dim declarationsCollection As New CodeAttributeDeclarationCollection()
declarationsCollection.Add(New CodeAttributeDeclaration("DescriptionAttribute", New CodeAttributeArgument(New CodePrimitiveExpression("Test Description"))))
declarationsCollection.Add(New CodeAttributeDeclaration("BrowsableAttribute", New CodeAttributeArgument(New CodePrimitiveExpression(True))))
collection.AddRange(declarationsCollection)

另請參閱

適用於