InstallerCollection.AddRange Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds the specified installers to this collection.
Overloads
AddRange(Installer[]) |
Adds the specified array of installers to this collection. |
AddRange(InstallerCollection) |
Adds the specified collection of installers to this collection. |
AddRange(Installer[])
Adds the specified array of installers to this 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())
Parameters
- value
- Installer[]
An array of type Installer that represents the installers to add to this collection.
Examples
The following example demonstrates the AddRange method of the InstallerCollection class. It creates AssemblyInstaller instances for MyAssembly1.exe
and MyAssembly2.exe
. These instances are added to a TransactedInstaller. The installation process installs both MyAssembly1.exe
and 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()))
Remarks
The Parent property of each added Installer is set to the Installer containing this collection.
See also
Applies to
AddRange(InstallerCollection)
Adds the specified collection of installers to this 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)
Parameters
- value
- InstallerCollection
An InstallerCollection that represents the installers to add to this collection.
Examples
The following example demonstrates the Insert method and the AddRange methods of the InstallerCollection class. It creates AssemblyInstaller instances for MyAssembly1.exe
and MyAssembly2.exe
. These instances of AssemblyInstaller are added to a TransactedInstaller named myTransactedInstaller1
. The installers in the myTransactedInstaller1
are copied to another TransactedInstaller named myTransactedInstaller2
. The installation process installs both MyAssembly1.exe
and 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)
Remarks
The Parent property of each added Installer is set to the Installer containing this collection.