Table of Contents

Method AsBoolOrNull

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

AsBoolOrNull(string)

Converts the value of the specified command-line argument to a nullable Boolean based on its string representation.

public virtual bool? AsBoolOrNull(string argName)

Parameters

argName string

The name of the command-line argument whose value is to be converted. The argument's value is expected to be 'true' or 'false', case-insensitive.

Returns

bool?

A nullable Boolean value: true if the argument value is 'true'; false if the argument value is 'false'; otherwise, null if the argument is not found or cannot be converted.

Remarks

If the argument is not present or its value does not match a valid Boolean representation, the method returns null. Any exceptions encountered during conversion are handled by invoking the OnError method.