共用方式為


CodeTypeMemberCollection.AddRange 方法

定義

CodeTypeMember 物件加入至集合的結尾。

多載

AddRange(CodeTypeMember[])

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

AddRange(CodeTypeMemberCollection)

將另一個 CodeTypeMemberCollection 的內容加入至集合末端。

AddRange(CodeTypeMember[])

來源:
CodeTypeMemberCollection.cs
來源:
CodeTypeMemberCollection.cs
來源:
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 個方法多載,將陣列的成員新增至 CodeTypeMemberCollection 物件,以及將一個成員加入另一個 CodeTypeMemberCollection 物件。

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

來源:
CodeTypeMemberCollection.cs
來源:
CodeTypeMemberCollection.cs
來源:
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 個方法多載,將數位列的成員新增至 CodeTypeMemberCollection 物件,以及將一個的成員加入另一個 CodeTypeMemberCollection

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

另請參閱

適用於