Бөлісу құралы:


InstallContext.IsParameterTrue(String) Метод

Определение

Определяет, является 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

Параметры

paramName
String

Имя проверяемого параметра командной строки.

Возвращаемое значение

true Значение "да", "true", "1" или пустая строка ("); falseв противном случае .

Примеры

Этот пример представляет собой фрагмент примера в обзоре InstallContext класса класса.

Он использует IsParameterTrue метод, чтобы узнать LogtoConsole , задан ли параметр. Если yesон будет использовать LogMessage метод для записи сообщений о состоянии в файл журнала установки и консоль.

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

Комментарии

Этот метод обращается к Parameters свойству, который содержит проанализированную версию параметров командной строки, чтобы определить, является trueли указанный параметр.

Применяется к

См. также раздел