次の方法で共有


ComponentInstaller.IsEquivalentInstaller メソッド

指定したインストーラが、対象のインストーラと同じオブジェクトをインストールするかどうかを確認します。

Public Overridable Function IsEquivalentInstaller( _
   ByVal otherInstaller As ComponentInstaller _) As Boolean
[C#]
public virtual bool IsEquivalentInstaller(ComponentInstallerotherInstaller);
[C++]
public: virtual bool IsEquivalentInstaller(ComponentInstaller* otherInstaller);
[JScript]
public function IsEquivalentInstaller(
   otherInstaller : ComponentInstaller) : Boolean;

パラメータ

  • otherInstaller
    比較対象のインストーラ。

戻り値

対象となるインストーラと otherInstaller パラメータで指定されたインストーラが同じオブジェクトをインストールする場合は true 。それ以外の場合は false

解説

通常、 IsEquivalentInstaller は、対象となるインストーラと otherInstaller パラメータで指定されたインストーラが同じオブジェクトをインストールする場合にだけ true を返します。そのような場合は、いずれのインストーラに対して Install メソッドまたは Uninstall メソッドを呼び出しても、結果としてのシステムの状態は変わりません。

使用例

[Visual Basic, C#, C++] イベント ログを作成し、イベント ログ コンポーネントのプロパティを EventLogInstaller オブジェクトにコピーする、クラス MyInstallClass を定義する例を次に示します。またこの例では、 ServiceInstaller オブジェクトが EventLogInstaller と同じ種類のインストールを処理できるかどうかをチェックします。

 
Dim myServiceInstaller As New ServiceInstaller()
' Check whether 'ServiceInstaller' object can handle the same 
' kind of installation as 'EventLogInstaller' object.
If myEventLogInstaller.IsEquivalentInstaller(myServiceInstaller) Then
   Console.WriteLine("'ServiceInstaller' can handle the same kind" + _
                              " of installation as EventLogInstaller")
Else
   Console.WriteLine("'ServiceInstaller' can't handle the same" + _
                        " kind of installation as 'EventLogInstaller'")
End If

[C#] 
ServiceInstaller myServiceInstaller = new  ServiceInstaller();
// Check whether 'ServiceInstaller' object can handle the same 
// kind of installation as 'EventLogInstaller' object.
if(myEventLogInstaller.IsEquivalentInstaller(myServiceInstaller))
{
   Console.WriteLine("'ServiceInstaller' can handle the same kind" 
                     +" of installation as EventLogInstaller");
}
else
{
    Console.WriteLine("'ServiceInstaller' can't handle the same" 
                 +" kind of installation as 'EventLogInstaller'");
}

[C++] 
ServiceInstaller* myServiceInstaller = new ServiceInstaller();
// Check whether 'ServiceInstaller' object can handle the same
// kind of installation as 'EventLogInstaller' object.
if (myEventLogInstaller->IsEquivalentInstaller(myServiceInstaller)) {
    Console::WriteLine(S"'ServiceInstaller' can handle the same kind  of installation as EventLogInstaller");
} else {
    Console::WriteLine(S"'ServiceInstaller' can't handle the same  kind of installation as 'EventLogInstaller'");
}

[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 セキュリティ:

参照

ComponentInstaller クラス | ComponentInstaller メンバ | System.Configuration.Install 名前空間