Language

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 指定されたパラメーターが "yes"、"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 プロパティにアクセスします。

適用対象

こちらもご覧ください