InstallContext.IsParameterTrue(String) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
指定したコマンド ライン パラメーターが 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
確認対象のコマンド ライン パラメーターの名前。
戻り値
指定したパラメーターが "yes"、"true"、"1"、または空の文字列 ("") の場合は true
。それ以外の場合は 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" ) == 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
注釈
このメソッドは、解析されたバージョンのコマンド ライン パラメーターを含む プロパティにアクセス Parameters して、指定されたパラメーターが true
かどうかを判断します。