ParseByte() public static method

Attempt to parse a string representation of a byte.
public static ParseByte ( string value ) : byte
value string
return byte
Exemplo n.º 1
0
        public static byte ReadByte(NetworkBinaryReader reader)
        {
            object value = ReadNonnullObject("byte", reader);

            if (value is byte)
            {
                return((byte)value);
            }
            if (value is string)
            {
                return(PrimitiveParser.ParseByte((string)value));
            }
            throw PrimitiveParser.CreateProtocolViolationException("byte", value);
        }
Exemplo n.º 2
0
        public static byte ReadByte(NetworkBinaryReader reader)
        {
            object value = ReadNonnullObject("byte", reader);

            if (value is byte)
            {
                return((byte)value);
            }
            if (value is string)
            {
                return(PrimitiveParser.ParseByte((string)value));
            }
            PrimitiveParser.InvalidConversion("byte", value);
            return(0);
        }