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 方法會導致相同的系統狀態。

適用於