Opc.Ua.JsonDecoder.ReadInt32 C# (CSharp) Method

ReadInt32() public method

Reads an int from the stream.
public ReadInt32 ( string fieldName ) : int
fieldName string
return int
        public int ReadInt32(string fieldName)
        {
            object token = null;

            if (!ReadField(fieldName, out token))
            {
                return 0;
            }

            var value = token as long?;

            if (value == null)
            {
                return 0;
            }

            if (value < Int32.MinValue || value > Int32.MaxValue)
            {
                return 0;
            }

            return (int)value;
        }