CodeTypeMemberCollection.AddRange 方法

定义

CodeTypeMember 对象添加到集合的末尾。

重载

AddRange(CodeTypeMember[])

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

AddRange(CodeTypeMemberCollection)

将另一个 CodeTypeMemberCollection 的内容添加到集合末尾。

AddRange(CodeTypeMember[])

Source:
CodeTypeMemberCollection.cs
Source:
CodeTypeMemberCollection.cs
Source:
CodeTypeMemberCollection.cs

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

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

参数

value
CodeTypeMember[]

CodeTypeMember 类型的数组,包含要添加到集合的对象。

例外

valuenull

示例

以下示例演示如何使用两AddRange个方法重载将数组的成员添加到 对象,以及如何将数组的成员添加到另一个CodeTypeMemberCollectionCodeTypeMemberCollection对象。

// Adds an array of CodeTypeMember objects to the collection.
array<CodeTypeMember^>^members = {gcnew CodeMemberField( "System.String","TestStringField1" ),gcnew CodeMemberField( "System.String","TestStringField2" )};
collection->AddRange( members );

// Adds a collection of CodeTypeMember objects to the collection.
CodeTypeMemberCollection^ membersCollection = gcnew CodeTypeMemberCollection;
membersCollection->Add( gcnew CodeMemberField( "System.String","TestStringField1" ) );
membersCollection->Add( gcnew CodeMemberField( "System.String","TestStringField2" ) );
collection->AddRange( membersCollection );
// Adds an array of CodeTypeMember objects to the collection.
CodeTypeMember[] members = { new CodeMemberField("System.String", "TestStringField1"), new CodeMemberField("System.String", "TestStringField2") };
collection.AddRange( members );

// Adds a collection of CodeTypeMember objects to the collection.
CodeTypeMemberCollection membersCollection = new CodeTypeMemberCollection();
membersCollection.Add( new CodeMemberField("System.String", "TestStringField1") );
membersCollection.Add( new CodeMemberField("System.String", "TestStringField2") );
collection.AddRange( membersCollection );
' Adds an array of CodeTypeMember objects to the collection.
Dim members As CodeTypeMember() = {New CodeMemberField("System.String", "TestStringField1"), New CodeMemberField("System.String", "TestStringField2")}
collection.AddRange(members)

' Adds a collection of CodeTypeMember objects to the collection.
Dim membersCollection As New CodeTypeMemberCollection()
membersCollection.Add(New CodeMemberField("System.String", "TestStringField1"))
membersCollection.Add(New CodeMemberField("System.String", "TestStringField2"))
collection.AddRange(membersCollection)

另请参阅

适用于

AddRange(CodeTypeMemberCollection)

Source:
CodeTypeMemberCollection.cs
Source:
CodeTypeMemberCollection.cs
Source:
CodeTypeMemberCollection.cs

将另一个 CodeTypeMemberCollection 的内容添加到集合末尾。

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

参数

value
CodeTypeMemberCollection

CodeTypeMemberCollection,包含要添加到集合的对象。

例外

valuenull

示例

下面的代码示例演示如何使用两AddRange个方法重载将数组的成员添加到 对象,以及如何将数组的成员添加到另一个CodeTypeMemberCollectionCodeTypeMemberCollection对象。

// Adds an array of CodeTypeMember objects to the collection.
array<CodeTypeMember^>^members = {gcnew CodeMemberField( "System.String","TestStringField1" ),gcnew CodeMemberField( "System.String","TestStringField2" )};
collection->AddRange( members );

// Adds a collection of CodeTypeMember objects to the collection.
CodeTypeMemberCollection^ membersCollection = gcnew CodeTypeMemberCollection;
membersCollection->Add( gcnew CodeMemberField( "System.String","TestStringField1" ) );
membersCollection->Add( gcnew CodeMemberField( "System.String","TestStringField2" ) );
collection->AddRange( membersCollection );
// Adds an array of CodeTypeMember objects to the collection.
CodeTypeMember[] members = { new CodeMemberField("System.String", "TestStringField1"), new CodeMemberField("System.String", "TestStringField2") };
collection.AddRange( members );

// Adds a collection of CodeTypeMember objects to the collection.
CodeTypeMemberCollection membersCollection = new CodeTypeMemberCollection();
membersCollection.Add( new CodeMemberField("System.String", "TestStringField1") );
membersCollection.Add( new CodeMemberField("System.String", "TestStringField2") );
collection.AddRange( membersCollection );
' Adds an array of CodeTypeMember objects to the collection.
Dim members As CodeTypeMember() = {New CodeMemberField("System.String", "TestStringField1"), New CodeMemberField("System.String", "TestStringField2")}
collection.AddRange(members)

' Adds a collection of CodeTypeMember objects to the collection.
Dim membersCollection As New CodeTypeMemberCollection()
membersCollection.Add(New CodeMemberField("System.String", "TestStringField1"))
membersCollection.Add(New CodeMemberField("System.String", "TestStringField2"))
collection.AddRange(membersCollection)

另请参阅

适用于