ComponentInstaller.IsEquivalentInstaller(ComponentInstaller) 方法

定义

确定指定的安装程序是否与此安装程序安装相同的对象。

public:
 virtual bool IsEquivalentInstaller(System::Configuration::Install::ComponentInstaller ^ otherInstaller);
public virtual bool IsEquivalentInstaller (System.Configuration.Install.ComponentInstaller otherInstaller);
abstract member IsEquivalentInstaller : System.Configuration.Install.ComponentInstaller -> bool
override this.IsEquivalentInstaller : System.Configuration.Install.ComponentInstaller -> bool
Public Overridable Function IsEquivalentInstaller (otherInstaller As ComponentInstaller) As Boolean

参数

otherInstaller
ComponentInstaller

要比较的安装程序。

返回

如果此安装程序和 otherInstaller 参数指定的安装程序安装相同的对象,则为 true;否则为 false

示例

以下示例定义一个类 ,该类 MyInstallClass创建事件日志并将事件日志组件的属性复制到 对象 EventLogInstaller 。 它还检查对象是否可以 ServiceInstaller 处理与 相同的安装 EventLogInstaller类型。

ServiceInstaller^ myServiceInstaller = gcnew 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'" );
}
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'");
}
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

注解

通常,IsEquivalentInstaller仅当此安装程序和参数otherInstaller指定的安装程序安装同一对象时,才返回 true 。 在这种情况下,在任一安装程序上调用 InstallUninstall 方法会导致相同的系统状态。

适用于