Partager via


InstallerCollection.AddRange Méthode

Définition

Ajoute les programmes d'installation spécifiés à cette collection.

Surcharges

AddRange(Installer[])

Ajoute le tableau spécifié de programmes d'installation à cette collection.

AddRange(InstallerCollection)

Ajoute la collection spécifiée de programmes d'installation à cette collection.

AddRange(Installer[])

Ajoute le tableau spécifié de programmes d'installation à cette collection.

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

Paramètres

value
Installer[]

Tableau de type Installer qui représente les programmes d'installation à ajouter à cette collection.

Exemples

L’exemple suivant illustre la AddRange méthode de la InstallerCollection classe . Il crée AssemblyInstaller des instances pour MyAssembly1.exe et MyAssembly2.exe. Ces instances sont ajoutées à un TransactedInstaller. Le processus d’installation installe à la fois MyAssembly1.exe et MyAssembly2.exe.

ArrayList^ myInstallers = gcnew ArrayList;
TransactedInstaller^ myTransactedInstaller = gcnew TransactedInstaller;
AssemblyInstaller^ myAssemblyInstaller;
InstallContext^ myInstallContext;

// Create a instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'.
myAssemblyInstaller =
   gcnew AssemblyInstaller( "MyAssembly1.exe",nullptr );

// Add the instance of 'AssemblyInstaller' to the list of installers.
myInstallers->Add( myAssemblyInstaller );

// Create a instance of 'AssemblyInstaller' that installs 'MyAssembly2.exe'.
myAssemblyInstaller =
   gcnew AssemblyInstaller( "MyAssembly2.exe",nullptr );

// Add the instance of 'AssemblyInstaller' to the list of installers.
myInstallers->Add( myAssemblyInstaller );

// Add the installers to the 'TransactedInstaller' instance.
myTransactedInstaller->Installers->AddRange( safe_cast<array<Installer^>^>(myInstallers->ToArray( Installer::typeid )) );
ArrayList myInstallers =new ArrayList();
TransactedInstaller myTransactedInstaller = new TransactedInstaller();
AssemblyInstaller myAssemblyInstaller;
InstallContext myInstallContext;

// Create a instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'.
myAssemblyInstaller =
   new AssemblyInstaller("MyAssembly1.exe", null);

// Add the instance of 'AssemblyInstaller' to the list of installers.
myInstallers.Add(myAssemblyInstaller);

// Create a instance of 'AssemblyInstaller' that installs 'MyAssembly2.exe'.
myAssemblyInstaller =
   new AssemblyInstaller("MyAssembly2.exe", null);

// Add the instance of 'AssemblyInstaller' to the list of installers.
myInstallers.Add(myAssemblyInstaller);

// Add the installers to the 'TransactedInstaller' instance.
myTransactedInstaller.Installers.AddRange((Installer[])myInstallers.ToArray(typeof(Installer)));
Dim myInstallers As New ArrayList()
Dim myTransactedInstaller As New TransactedInstaller()
Dim myAssemblyInstaller As AssemblyInstaller
Dim myInstallContext As InstallContext

' Create a instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'.
myAssemblyInstaller = New AssemblyInstaller("MyAssembly1.exe", Nothing)

' Add the instance of 'AssemblyInstaller' to the list of installers.  
myInstallers.Add(myAssemblyInstaller)

' Create a instance of 'AssemblyInstaller' that installs 'MyAssembly2.exe'.
myAssemblyInstaller = New AssemblyInstaller("MyAssembly2.exe", Nothing)

' Add the instance of 'AssemblyInstaller' to the list of installers.  
myInstallers.Add(myAssemblyInstaller)

' Add the installers to the 'TransactedInstaller' instance.
myTransactedInstaller.Installers.AddRange(CType(myInstallers.ToArray(GetType(Installer)), _
                                                                     Installer()))

Remarques

La Parent propriété de chaque ajout Installer est définie sur le Installer contenant cette collection.

Voir aussi

S’applique à

AddRange(InstallerCollection)

Ajoute la collection spécifiée de programmes d'installation à cette collection.

public:
 void AddRange(System::Configuration::Install::InstallerCollection ^ value);
public void AddRange (System.Configuration.Install.InstallerCollection value);
member this.AddRange : System.Configuration.Install.InstallerCollection -> unit
Public Sub AddRange (value As InstallerCollection)

Paramètres

value
InstallerCollection

InstallerCollection qui représente les programmes d'installation à ajouter à cette collection.

Exemples

L’exemple suivant illustre la Insert méthode et les AddRange méthodes de la InstallerCollection classe . Il crée AssemblyInstaller des instances pour MyAssembly1.exe et MyAssembly2.exe. Ces instances de AssemblyInstaller sont ajoutées à un TransactedInstaller nommé myTransactedInstaller1. Les programmes d’installation dans le myTransactedInstaller1 sont copiés dans un autre TransactedInstaller nommé myTransactedInstaller2. Le processus d’installation installe à la fois MyAssembly1.exe et MyAssembly2.exe.

TransactedInstaller^ myTransactedInstaller1 = gcnew TransactedInstaller;
TransactedInstaller^ myTransactedInstaller2 = gcnew TransactedInstaller;
AssemblyInstaller^ myAssemblyInstaller = gcnew AssemblyInstaller;
InstallContext^ myInstallContext;

// Create a instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'.
myAssemblyInstaller =
   gcnew AssemblyInstaller( "MyAssembly1.exe",nullptr );

// Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'.
myTransactedInstaller1->Installers->Insert( 0, myAssemblyInstaller );

// Create a instance of 'AssemblyInstaller' that installs 'MyAssembly2.exe'.
myAssemblyInstaller =
   gcnew AssemblyInstaller( "MyAssembly2.exe",nullptr );

// Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'.
myTransactedInstaller1->Installers->Insert( 1, myAssemblyInstaller );

// Copy the installers of 'myTransactedInstaller1' to 'myTransactedInstaller2'.
myTransactedInstaller2->Installers->AddRange( myTransactedInstaller1->Installers );
TransactedInstaller myTransactedInstaller1 = new TransactedInstaller();
TransactedInstaller myTransactedInstaller2 = new TransactedInstaller();
AssemblyInstaller myAssemblyInstaller = new AssemblyInstaller();
InstallContext myInstallContext;

// Create a instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'.
myAssemblyInstaller =
   new AssemblyInstaller("MyAssembly1.exe", null);

// Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'.
myTransactedInstaller1.Installers.Insert(0, myAssemblyInstaller);

// Create a instance of 'AssemblyInstaller' that installs 'MyAssembly2.exe'.
myAssemblyInstaller =
   new AssemblyInstaller("MyAssembly2.exe", null);

// Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'.
myTransactedInstaller1.Installers.Insert(1, myAssemblyInstaller);

// Copy the installers of 'myTransactedInstaller1' to 'myTransactedInstaller2'.
myTransactedInstaller2.Installers.AddRange(myTransactedInstaller1.Installers);
Dim myTransactedInstaller1 As New TransactedInstaller()
Dim myTransactedInstaller2 As New TransactedInstaller()
Dim myAssemblyInstaller As New AssemblyInstaller()
Dim myInstallContext As InstallContext

' Create a instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'.
myAssemblyInstaller = New AssemblyInstaller("MyAssembly1.exe", Nothing)

' Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'.
myTransactedInstaller1.Installers.Insert(0, myAssemblyInstaller)

' Create a instance of 'AssemblyInstaller' that installs 'MyAssembly2.exe'.
myAssemblyInstaller = New AssemblyInstaller("MyAssembly2.exe", Nothing)

' Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'.
myTransactedInstaller1.Installers.Insert(1, myAssemblyInstaller)

' Copy the installers of 'myTransactedInstaller1' to 'myTransactedInstaller2'.
myTransactedInstaller2.Installers.AddRange(myTransactedInstaller1.Installers)

Remarques

La Parent propriété de chaque ajout Installer est définie sur le Installer contenant cette collection.

Voir aussi

S’applique à