InstallContext.IsParameterTrue(String) Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Belirtilen komut satırı parametresinin true
olup 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
.