ParseBool() public static method

Attempt to parse a string representation of a bool.
public static ParseBool ( string value ) : bool
value string
return bool
Example #1
0
        public static bool ReadBool(NetworkBinaryReader reader)
        {
            object value = ReadNonnullObject("bool", reader);

            if (value is bool)
            {
                return((bool)value);
            }
            if (value is string)
            {
                return(PrimitiveParser.ParseBool((string)value));
            }
            throw PrimitiveParser.CreateProtocolViolationException("bool", value);
        }
        public static bool ReadBool(NetworkBinaryReader reader)
        {
            object value = ReadNonnullObject("bool", reader);

            if (value is bool)
            {
                return((bool)value);
            }
            if (value is string)
            {
                return(PrimitiveParser.ParseBool((string)value));
            }
            PrimitiveParser.InvalidConversion("bool", value);
            return(false);
        }