.NET Framework Class Library
InstallContext.IsParameterTrue Method

Determines whether the specified command-line parameter is true.

Namespace: System.Configuration.Install
Assembly: System.Configuration.Install (in system.configuration.install.dll)

Syntax

Visual Basic (Declaration)
Public Function IsParameterTrue ( _
    paramName As String _
) As Boolean
Visual Basic (Usage)
Dim instance As InstallContext
Dim paramName As String
Dim returnValue As Boolean

returnValue = instance.IsParameterTrue(paramName)
C#
public bool IsParameterTrue (
    string paramName
)
C++
public:
bool IsParameterTrue (
    String^ paramName
)
J#
public boolean IsParameterTrue (
    String paramName
)
JScript
public function IsParameterTrue (
    paramName : String
) : boolean

Parameters

paramName

The name of the command-line parameter to check.

Return Value

true if the specified parameter is set to "yes", "true", "1", or an empty string (""); otherwise, false.
Remarks

This method accesses the Parameters property, which contains a parsed version of the command-line parameters, to determine whether the specified parameter is true.

Example

This example is an excerpt of the sample in the class overview of the InstallContext class.

It uses the IsParameterTrue method to find out if the LogtoConsole parameter has been set. If yes, it will then use the LogMessage method to write status messages to the installation log file and the console.

Visual Basic
' 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
C#
// 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" );
C++
// 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" );
J#
// 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");
.NET Framework Security

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .
Platforms

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

Version Information

.NET Framework

Supported in: 2.0, 1.1, 1.0
See Also

Tags :


Page view tracker