Partager via


CodeTypeMemberCollection.AddRange Méthode

Définition

Ajoute des objets CodeTypeMember à la fin de la collection.

Surcharges

AddRange(CodeTypeMember[])

Copie les éléments du tableau CodeTypeMember spécifié à la fin de la collection.

AddRange(CodeTypeMemberCollection)

Ajoute le contenu d'une autre CodeTypeMemberCollection à la fin de la collection.

AddRange(CodeTypeMember[])

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

Copie les éléments du tableau CodeTypeMember spécifié à la fin de la collection.

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

Paramètres

value
CodeTypeMember[]

Tableau de type CodeTypeMember contenant les objets à ajouter à la collection.

Exceptions

value a la valeur null.

Exemples

L’exemple suivant montre comment utiliser les deux AddRange surcharges de méthode pour ajouter les membres d’un tableau à un CodeTypeMemberCollection objet et pour ajouter les membres de l’un à l’autre 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)

Voir aussi

S’applique à

AddRange(CodeTypeMemberCollection)

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

Ajoute le contenu d'une autre CodeTypeMemberCollection à la fin de la collection.

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)

Paramètres

value
CodeTypeMemberCollection

CodeTypeMemberCollection contenant les objets à ajouter à la collection.

Exceptions

value a la valeur null.

Exemples

L’exemple de code suivant montre comment utiliser les deux AddRange surcharges de méthode pour ajouter les membres d’un tableau à un CodeTypeMemberCollection objet et pour ajouter les membres de l’un à l’autre 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)

Voir aussi

S’applique à