InstallerCollection::Contains Method (Installer^)
Determines whether the specified installer is included in collection.
Assembly: System.Configuration.Install (in System.Configuration.Install.dll)
Parameters
- value
-
Type:
System.Configuration.Install::Installer^
An Installer that represents the installer to look for.
Return Value
Type: System::Booleantrue if the specified installer is in this collection; otherwise, false.
The following example demonstrates the Remove method, Contains method, and IndexOf method of the InstallerCollection class. It creates AssemblyInstaller instances for MyAssembly1.exe and MyAssembly2.exe. These instances are added to a TransactedInstaller. MyAssembly2.exe is then removed from the InstallerCollection of the TransactedInstaller. The installation process starts and installs only MyAssembly1.exe.
TransactedInstaller^ myTransactedInstaller = gcnew TransactedInstaller; AssemblyInstaller^ myAssemblyInstaller1; AssemblyInstaller^ myAssemblyInstaller2; InstallContext^ myInstallContext; // Create a instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'. myAssemblyInstaller1 = gcnew AssemblyInstaller( "MyAssembly1.exe",nullptr ); // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. myTransactedInstaller->Installers->Insert( 0, myAssemblyInstaller1 ); // Create a instance of 'AssemblyInstaller' that installs 'MyAssembly2.exe'. myAssemblyInstaller2 = gcnew AssemblyInstaller( "MyAssembly2.exe",nullptr ); // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. myTransactedInstaller->Installers->Insert( 1, myAssemblyInstaller2 ); // Remove the 'myAssemblyInstaller2' from the 'Installers' collection. if ( myTransactedInstaller->Installers->Contains( myAssemblyInstaller2 ) ) { Console::WriteLine( "\nInstaller at index : {0} is being removed", myTransactedInstaller->Installers->IndexOf( myAssemblyInstaller2 ) ); myTransactedInstaller->Installers->Remove( myAssemblyInstaller2 ); }
Available since 1.1