Installer.Installers 属性

定义

获取该安装程序包含的安装程序的集合。Gets the collection of installers that this installer contains.

public:
 property System::Configuration::Install::InstallerCollection ^ Installers { System::Configuration::Install::InstallerCollection ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Configuration.Install.InstallerCollection Installers { get; }
public System.Configuration.Install.InstallerCollection Installers { get; }
[<System.ComponentModel.Browsable(false)>]
member this.Installers : System.Configuration.Install.InstallerCollection
member this.Installers : System.Configuration.Install.InstallerCollection
Public ReadOnly Property Installers As InstallerCollection

属性值

InstallerCollection

InstallerCollection 包含与该安装程序关联的安装程序的集合。An InstallerCollection containing the collection of installers associated with this installer.

属性

示例

下面的示例演示了 InstallersParent 属性。The following example demonstrates the Installers and Parent properties. Installers属性显示 InstallerCollection 与关联的 InstallerThe Installers property shows the InstallerCollection associated with an Installer.

AssemblyInstaller^ myAssemblyInstaller = gcnew AssemblyInstaller;
ServiceInstaller^ myServiceInstaller = gcnew ServiceInstaller;
EventLogInstaller^ myEventLogInstaller = gcnew EventLogInstaller;

InstallerCollection^ myInstallerCollection = myAssemblyInstaller->Installers;

// Add Installers to the InstallerCollection of 'myAssemblyInstaller'.
myInstallerCollection->Add( myServiceInstaller );
myInstallerCollection->Add( myEventLogInstaller );

array<Installer^>^ myInstaller = gcnew array<Installer^>(2);
myInstallerCollection->CopyTo( myInstaller, 0 );
// Show the contents of the InstallerCollection of 'myAssemblyInstaller'.
Console::WriteLine( "Installers in the InstallerCollection : " );
for ( int iIndex = 0; iIndex < myInstaller->Length; iIndex++ )
   Console::WriteLine( myInstaller[ iIndex ]->ToString() );
AssemblyInstaller myAssemblyInstaller = new AssemblyInstaller();
ServiceInstaller myServiceInstaller = new ServiceInstaller();
EventLogInstaller myEventLogInstaller = new EventLogInstaller();

InstallerCollection myInstallerCollection = myAssemblyInstaller.Installers;

// Add Installers to the InstallerCollection of 'myAssemblyInstaller'.
myInstallerCollection.Add(myServiceInstaller);
myInstallerCollection.Add(myEventLogInstaller);

Installer[] myInstaller = new Installer[2];
myInstallerCollection.CopyTo(myInstaller,0);
// Show the contents of the InstallerCollection of 'myAssemblyInstaller'.
Console.WriteLine("Installers in the InstallerCollection : ");
for (int iIndex=0; iIndex < myInstaller.Length; iIndex++)
   Console.WriteLine(myInstaller[iIndex].ToString());
Dim myAssemblyInstaller As New AssemblyInstaller()
Dim myServiceInstaller As New ServiceInstaller()
Dim myEventLogInstaller As New EventLogInstaller()
Dim myInstallerCollection As InstallerCollection = _
                                       myAssemblyInstaller.Installers

' Add Installers to the InstallerCollection of 'myAssemblyInstaller'.
myInstallerCollection.Add(myServiceInstaller)
myInstallerCollection.Add(myEventLogInstaller)

Dim myInstaller(1) As Installer
myInstallerCollection.CopyTo(myInstaller, 0)
' Show the contents of the InstallerCollection of 'myAssemblyInstaller'.
Console.WriteLine("Installers in the InstallerCollection : ")
Dim iIndex As Integer
For iIndex = 0 To myInstaller.Length - 1
   Console.WriteLine(myInstaller(iIndex).ToString())
Next iIndex

注解

Installers属性包含安装程序的集合,这些安装程序安装此 Installer 实例正确安装组件所需的对象。The Installers property contains a collection of installers that install objects needed by this Installer instance to correctly install the component. Install类的、、 Commit RollbackUninstall 方法将 Installer 遍历安装程序的集合,并调用每个安装程序的相应方法。The Install, Commit, Rollback, and Uninstall methods of the Installer class go through the collection of installers and invokes the corresponding method of each installer.

如果的此实例 Installer 包含在安装程序集合中,则该 Parent 属性是 Installer 包含该集合的实例。If this instance of Installer is contained in an installer collection, the Parent property is the Installer instance that contains the collection. 有关使用集合的示例 Installers ,请参阅 AssemblyInstaller 类。For an example of the use of the Installers collection, see the AssemblyInstaller class.

适用于

另请参阅