CodeAttributeDeclarationCollection.AddRange 方法

定义

将指定的 CodeAttributeDeclaration 数组的元素复制到集合末尾。

重载

AddRange(CodeAttributeDeclaration[])

将指定的 CodeAttributeDeclaration 数组的元素复制到集合末尾。

AddRange(CodeAttributeDeclarationCollection)

将另一个 CodeAttributeDeclarationCollection 对象的内容复制到集合的末尾。

AddRange(CodeAttributeDeclaration[])

Source:
CodeAttributeDeclarationCollection.cs
Source:
CodeAttributeDeclarationCollection.cs
Source:
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)

Source:
CodeAttributeDeclarationCollection.cs
Source:
CodeAttributeDeclarationCollection.cs
Source:
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)

另请参阅

适用于