ComponentInstaller.IsEquivalentInstaller(ComponentInstaller) Metoda

Definicja

Określa, czy określony instalator instaluje ten sam obiekt co ten instalator.

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

Parametry

otherInstaller
ComponentInstaller

Instalator do porównania.

Zwraca

true jeśli ten instalator i instalator określony przez otherInstaller parametr instalują ten sam obiekt; w przeciwnym razie false.

Przykłady

W poniższym przykładzie zdefiniowano klasę MyInstallClass, która tworzy dziennik zdarzeń i kopiuje właściwości składnika dziennika zdarzeń do EventLogInstaller obiektu. Sprawdza również, czy ServiceInstaller obiekt może obsługiwać ten sam rodzaj instalacji co 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

Uwagi

Zazwyczaj zwraca wartość true tylko wtedy, IsEquivalentInstaller gdy ten instalator i instalator określony przez otherInstaller parametr instalują ten sam obiekt. W takim przypadku wywołanie Install metody or Uninstall w instalatorze powoduje wystąpienie tego samego stanu systemu.

Dotyczy