次の方法で共有


InstallerCollection.AddRange メソッド (Installer )

指定したインストーラ配列をコレクションに追加します。

Overloads Public Sub AddRange( _
   ByVal value() As Installer _)
[C#]
public void AddRange(Installer[] value);
[C++]
public: void AddRange(Installer* value[]);
[JScript]
public function AddRange(
   value : Installer[]);

パラメータ

  • value
    コレクションに追加するインストーラを表す Installer 型の配列。

解説

追加された各 InstallerParent プロパティには、追加先のコレクションを格納している Installer が設定されます。

使用例

[Visual Basic, C#, C++] InstallerCollection クラスの AddRange メソッドの例を次に示します。この例では、 MyAssembly1.exe および MyAssembly2.exeAssemblyInstaller インスタンスを作成します。これらのインスタンスは、 TransactedInstaller に追加されます。インストール プロセスによって、 MyAssembly1.exeMyAssembly2.exe の両方がインストールされます。

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

[C#] 
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)));

[C++] 
ArrayList* myInstallers = new ArrayList();
TransactedInstaller* myTransactedInstaller = new TransactedInstaller();
AssemblyInstaller* myAssemblyInstaller;
InstallContext* myInstallContext;

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

// 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(S"MyAssembly2.exe", 0);

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

// Add the installers to the 'TransactedInstaller' instance.
myTransactedInstaller->Installers->AddRange(__try_cast<Installer*[]>(myInstallers->ToArray(__typeof(Installer))));

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

.NET Framework セキュリティ:

参照

InstallerCollection クラス | InstallerCollection メンバ | System.Configuration.Install 名前空間 | InstallerCollection.AddRange オーバーロードの一覧 | Add | Remove | Installer