ThisToThat/ThisToThat/ToBooleanExtensions.cs
/// <summary>
/// Converts and returns this char's value as a boolean or the specified default value.
/// Values which will convert to true are: 'T', 'Y', '1'
/// Values which will convert to false are: 'F', 'N', '0'
/// All other values will convert to the default specified.
/// </summary>
Converts and returns this char's value as a boolean or the specified default value.
Converts and returns this char ' s value as a boolean or the specified default value .
public static bool ToBooleanOrDefault(this char thisChar, bool defaultValue = default(bool))
        {
            bool returnValue = defaultValue;
            if (_TRUE_CHARS.Contains(thisChar))
                returnValue = true;
            else if (_FALSE_CHARS.Contains(thisChar))
                returnValue = false;
            return returnValue;
        }
public static bool ToBooleanOrDefault ( this char thisChar , bool defaultValue = default ( bool ) ) { bool returnValue = defaultValue ; if ( _TRUE_CHARS . Contains ( thisChar ) ) returnValue = true ; else if ( _FALSE_CHARS . Contains ( thisChar ) ) returnValue = false ; return returnValue ; }
Converts and returns this char's value as a boolean or the specified default value.
Converts and returns this char ' s value as a boolean or the specified default value .
char
this
defaultValue
bool