ParseBool() public static method

Attempt to parse a string representation of a bool.
public static ParseBool ( string value ) : bool
value string
return bool
Ejemplo n.º 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);
        }
Ejemplo n.º 2
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));
            }
            PrimitiveParser.InvalidConversion("bool", value);
            return(false);
        }