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

ReadUInt16() public method

Reads a ushort from the stream.
public ReadUInt16 ( string fieldName ) : ushort
fieldName string
return ushort
        public ushort ReadUInt16(string fieldName)
        {
            object token = null;

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

            var value = token as long?;

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

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

            return (ushort)value;
        }