ComponentInstaller.IsEquivalentInstaller 方法

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

**命名空间:**System.Configuration.Install
**程序集:**System.Configuration.Install(在 system.configuration.install.dll 中)

语法

声明
Public Overridable Function IsEquivalentInstaller ( _
    otherInstaller As ComponentInstaller _
) As Boolean
用法
Dim instance As ComponentInstaller
Dim otherInstaller As ComponentInstaller
Dim returnValue As Boolean

returnValue = instance.IsEquivalentInstaller(otherInstaller)
public virtual bool IsEquivalentInstaller (
    ComponentInstaller otherInstaller
)
public:
virtual bool IsEquivalentInstaller (
    ComponentInstaller^ otherInstaller
)
public boolean IsEquivalentInstaller (
    ComponentInstaller otherInstaller
)
public function IsEquivalentInstaller (
    otherInstaller : ComponentInstaller
) : boolean

参数

  • otherInstaller
    要比较的安装程序。

返回值

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

备注

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

示例

下面的示例定义类 MyInstallClass,该类创建事件日志,并将事件日志组件的属性复制到 EventLogInstaller 对象中。它还检查 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
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'");
}
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'");
}

.NET Framework 安全性

  • 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见。

平台

Windows 98、Windows 2000 SP4、Windows Millennium Edition、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

ComponentInstaller 类
ComponentInstaller 成员
System.Configuration.Install 命名空间