Aracılığıyla paylaş


InstallContext.IsParameterTrue(String) Yöntem

Tanım

Belirtilen komut satırı parametresinin trueolup olmadığını belirler.

public:
 bool IsParameterTrue(System::String ^ paramName);
public bool IsParameterTrue (string paramName);
member this.IsParameterTrue : string -> bool
Public Function IsParameterTrue (paramName As String) As Boolean

Parametreler

paramName
String

Denetlenecek komut satırı parametresinin adı.

Döndürülenler

true belirtilen parametre "yes", "true", "1" veya boş bir dize ("") olarak ayarlanırsa; aksi takdirde , false.

Örnekler

Bu örnek, sınıfın sınıfına genel bakış içindeki örnekten bir alıntıdır InstallContext .

Parametresinin IsParameterTrue ayarlandığını bulmak LogtoConsole için yöntemini kullanır. ise yes, yükleme günlük dosyasına ve konsola durum iletileri yazmak için yöntemini kullanır 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

Açıklamalar

Bu yöntem, belirtilen parametrenin Parameters olup olmadığını belirlemek için komut satırı parametrelerinin ayrıştırılmış sürümünü içeren özelliğine erişir true.

Şunlara uygulanır

Ayrıca bkz.