ParseInt() public static method

Attempt to parse a string representation of an int.
public static ParseInt ( string value ) : int
value string
return int
Ejemplo n.º 1
0
        public static int ReadInt32(NetworkBinaryReader reader)
        {
            object value = ReadNonnullObject("int", reader);

            if (value is int || value is short || value is byte)
            {
                return((int)value);
            }
            if (value is string)
            {
                return(PrimitiveParser.ParseInt((string)value));
            }
            throw PrimitiveParser.CreateProtocolViolationException("int", value);
        }
Ejemplo n.º 2
0
        public static int ReadInt32(NetworkBinaryReader reader)
        {
            object value = ReadNonnullObject("int", reader);

            if (value is int || value is short || value is byte)
            {
                return((int)value);
            }
            if (value is string)
            {
                return(PrimitiveParser.ParseInt((string)value));
            }
            PrimitiveParser.InvalidConversion("int", value);
            return(0);
        }