Partilhar via


CodeTypeMemberCollection.AddRange Método

Definição

Adiciona objetos CodeTypeMember ao final da coleção.

Sobrecargas

AddRange(CodeTypeMember[])

Copia os elementos da matriz CodeTypeMember especificada para o fim da coleção.

AddRange(CodeTypeMemberCollection)

Adiciona o conteúdo de outro CodeTypeMemberCollection ao final da coleção.

AddRange(CodeTypeMember[])

Origem:
CodeTypeMemberCollection.cs
Origem:
CodeTypeMemberCollection.cs
Origem:
CodeTypeMemberCollection.cs

Copia os elementos da matriz CodeTypeMember especificada para o fim da coleção.

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

Parâmetros

value
CodeTypeMember[]

A matriz do tipo CodeTypeMember que contém os objetos a serem adicionados à coleção.

Exceções

value é null.

Exemplos

O exemplo a seguir demonstra como usar as duas AddRange sobrecargas de método para adicionar os membros de uma matriz a um CodeTypeMemberCollection objeto e adicionar os membros de um CodeTypeMemberCollection a outro.

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

Confira também

Aplica-se a

AddRange(CodeTypeMemberCollection)

Origem:
CodeTypeMemberCollection.cs
Origem:
CodeTypeMemberCollection.cs
Origem:
CodeTypeMemberCollection.cs

Adiciona o conteúdo de outro CodeTypeMemberCollection ao final da coleção.

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)

Parâmetros

value
CodeTypeMemberCollection

Um CodeTypeMemberCollection que contém os objetos a serem adicionados à coleção.

Exceções

value é null.

Exemplos

O exemplo de código a seguir demonstra como usar as duas AddRange sobrecargas de método para adicionar os membros de uma matriz a um CodeTypeMemberCollection objeto e adicionar os membros de um CodeTypeMemberCollection a outro.

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

Confira também

Aplica-se a