InstallerCollection.IndexOf(Installer) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
コレクション内の指定したインストーラーのインデックスを確認します。
public:
int IndexOf(System::Configuration::Install::Installer ^ value);
public int IndexOf (System.Configuration.Install.Installer value);
member this.IndexOf : System.Configuration.Install.Installer -> int
Public Function IndexOf (value As Installer) As Integer
パラメーター
戻り値
コレクション内のインストーラーの 0 以上のインデックス。
例
次の例は、 メソッドの例と Contains 同じです。 この例の詳細については、 メソッドの例に関するセクションを Contains 参照してください。
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 );
}
TransactedInstaller myTransactedInstaller = new TransactedInstaller();
AssemblyInstaller myAssemblyInstaller1;
AssemblyInstaller myAssemblyInstaller2;
InstallContext myInstallContext;
// Create a instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'.
myAssemblyInstaller1 =
new AssemblyInstaller("MyAssembly1.exe", null);
// Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'.
myTransactedInstaller.Installers.Insert(0, myAssemblyInstaller1);
// Create a instance of 'AssemblyInstaller' that installs 'MyAssembly2.exe'.
myAssemblyInstaller2 =
new AssemblyInstaller("MyAssembly2.exe", null);
// 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);
}
Dim myTransactedInstaller As New TransactedInstaller()
Dim myAssemblyInstaller1 As AssemblyInstaller
Dim myAssemblyInstaller2 As AssemblyInstaller
Dim myInstallContext As InstallContext
' Create a instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'.
myAssemblyInstaller1 = New AssemblyInstaller("MyAssembly1.exe", Nothing)
' Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'.
myTransactedInstaller.Installers.Insert(0, myAssemblyInstaller1)
' Create a instance of 'AssemblyInstaller' that installs 'MyAssembly2.exe'.
myAssemblyInstaller2 = New AssemblyInstaller("MyAssembly2.exe", Nothing)
' 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) Then
Console.WriteLine(ControlChars.Newline + "Installer at index : {0} is being removed", _
myTransactedInstaller.Installers.IndexOf(myAssemblyInstaller2))
myTransactedInstaller.Installers.Remove(myAssemblyInstaller2)
End If
適用対象
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
.NET