Sdílet prostřednictvím


InstallContext.IsParameterTrue(String) Metoda

Definice

Určuje, zda je truezadaný parametr příkazového řádku .

public:
 bool IsParameterTrue(System::String ^ paramName);
public bool IsParameterTrue(string paramName);
member this.IsParameterTrue : string -> bool
Public Function IsParameterTrue (paramName As String) As Boolean

Parametry

paramName
String

Název parametru příkazového řádku, který chcete zkontrolovat.

Návraty

truePokud je zadaný parametr nastavený na ano, true, 1 nebo prázdný řetězec ("); v opačném případě . false

Příklady

Tento příklad je výňatek ukázky v přehledu InstallContext třídy.

Pomocí IsParameterTrue metody zjistí, jestli LogtoConsole byl parametr nastaven. Pokud yes, pak použije metodu LogMessage k zápisu stavových zpráv do souboru protokolu instalace a konzoly.

// Check whether the "LogtoConsole" parameter has been set.
if ( myInstallContext->IsParameterTrue( "LogtoConsole" ) )
{
   // Display the message to the console and add it to the logfile.
   myInstallContext->LogMessage( "The 'Install' method has been called" );
}
// Check whether the "LogtoConsole" parameter has been set.
if ( myInstallContext.IsParameterTrue( "LogtoConsole" ))
{
   // Display the message to the console and add it to the logfile.
   myInstallContext.LogMessage( "The 'Install' method has been called" );
}
' Check wether the "LogtoConsole" parameter has been set.
If myInstallContext.IsParameterTrue("LogtoConsole") = True Then
   ' Display the message to the console and add it to the logfile.
   myInstallContext.LogMessage("The 'Install' method has been called")
End If

Poznámky

Tato metoda přistupuje k Parameters vlastnosti, která obsahuje parsovanou verzi parametrů příkazového řádku k určení, zda je truezadaný parametr .

Platí pro

Viz také