InstallContext.IsParameterTrue(String) Methode

Definitie

Bepaalt of de opgegeven opdrachtregelparameter is 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

Parameters

paramName
String

De naam van de opdrachtregelparameter die u wilt controleren.

Retouren

true als de opgegeven parameter is ingesteld op 'ja', 'true', '1' of een lege tekenreeks (""); anders, false.

Voorbeelden

Dit voorbeeld is een fragment van het voorbeeld in het klasseoverzicht van de InstallContext klasse.

Er wordt gebruikgemaakt van de IsParameterTrue methode om erachter te komen of de LogtoConsole parameter is ingesteld. Als yes, wordt de methode gebruikt LogMessage om statusberichten naar het installatielogboekbestand en de console te schrijven.

// 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

Opmerkingen

Deze methode heeft toegang tot de Parameters eigenschap, die een geparseerde versie van de opdrachtregelparameters bevat, om te bepalen of de opgegeven parameter is true.

Van toepassing op

Zie ook