InstallerCollection.Item[Int32] プロパティ

定義

指定したインデックスにあるインストーラーを取得または設定します。

public:
 property System::Configuration::Install::Installer ^ default[int] { System::Configuration::Install::Installer ^ get(int index); void set(int index, System::Configuration::Install::Installer ^ value); };
public System.Configuration.Install.Installer this[int index] { get; set; }
member this.Item(int) : System.Configuration.Install.Installer with get, set
Default Public Property Item(index As Integer) As Installer

パラメーター

index
Int32

取得または設定するインストーラーの 0 以上のインデックス。

プロパティ値

指定したインデックスにあるインストーラーを表す Installer

次の例では、MyAssembly1.exeおよびMyAssembly2.exeAssemblyInstallerインスタンスを作成します。 これらのインスタンスはTransactedInstallerに追加されます。 インストールされるすべてのアセンブリの名前がコンソールに表示されます。 インストール プロセスでは、 と MyAssembly2.exeの両方MyAssembly1.exeがインストールされます。

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 'TransactedInstaller'.
myTransactedInstaller->Installers->Add( myAssemblyInstaller );

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

// Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'.
myTransactedInstaller->Installers->Add( myAssemblyInstaller );

//Print the assemblies to be installed.
InstallerCollection^ myInstallers = myTransactedInstaller->Installers;
Console::WriteLine( "\nPrinting all assemblies to be installed" );
for ( int i = 0; i < myInstallers->Count; i++ )
{
   if ( dynamic_cast<AssemblyInstaller^>(myInstallers[ i ]) )
   {
      Console::WriteLine( "{0} {1}", i + 1, safe_cast<AssemblyInstaller^>(myInstallers[ i ])->Path );
   }
}
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 'TransactedInstaller'.
myTransactedInstaller.Installers.Add(myAssemblyInstaller);

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

// Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'.
myTransactedInstaller.Installers.Add(myAssemblyInstaller);

//Print the assemblies to be installed.
InstallerCollection myInstallers = myTransactedInstaller.Installers;
Console.WriteLine("\nPrinting all assemblies to be installed");
for(int i = 0; i < myInstallers.Count; i++)
{
   if((myInstallers[i].GetType()).Equals(typeof(AssemblyInstaller)))
   {
      Console.WriteLine("{0} {1}", i + 1,
         ((AssemblyInstaller)myInstallers[i]).Path);
   }
}
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 'TransactedInstaller'.
myTransactedInstaller.Installers.Add(myAssemblyInstaller)

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

' Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'.  
myTransactedInstaller.Installers.Add(myAssemblyInstaller)

'Print the assemblies to be installed.
Dim myInstallers As InstallerCollection = myTransactedInstaller.Installers
Console.WriteLine(ControlChars.Newline + "Printing all assemblies to be installed")
Dim i As Integer
For i = 0 To myInstallers.Count - 1
   If myInstallers(i).GetType().Equals(GetType(AssemblyInstaller)) Then
      Console.WriteLine("{0} {1}", i + 1, CType(myInstallers(i), AssemblyInstaller).Path)
   End If
Next i

注釈

指定したInstallerInstallerCollectionに配置されている場合、InstallerParentプロパティは、コレクションを含むInstallerに設定されます。

適用対象

こちらもご覧ください