Udostępnij za pośrednictwem


InstallContext.IsParameterTrue(String) Metoda

Definicja

Określa, czy określony parametr wiersza polecenia to true.

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

Nazwa parametru wiersza polecenia do sprawdzenia.

Zwraca

true jeśli określony parametr ma wartość "yes", "true", "1" lub pusty ciąg (""); w przeciwnym razie , false.

Przykłady

Ten przykład jest fragmentem przykładu w przeglądzie klasy klasy InstallContext .

Używa IsParameterTrue metody , aby dowiedzieć się, czy LogtoConsole parametr został ustawiony. Jeśli yesparametr , użyje LogMessage metody do zapisywania komunikatów o stanie w pliku dziennika instalacji i konsoli programu .

// 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" ) == true )
{
   // 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

Uwagi

Ta metoda uzyskuje Parameters dostęp do właściwości zawierającej przeanalizowaną wersję parametrów wiersza polecenia, aby określić, czy określony parametr to true.

Dotyczy

Zobacz też