Opc.Ua.JsonEncoder.WriteUInt16Array C# (CSharp) Method

WriteUInt16Array() public method

Writes a ushort array to the stream.
public WriteUInt16Array ( string fieldName, IList values ) : void
fieldName string
values IList
return void
        public void WriteUInt16Array(string fieldName, IList<ushort> values)
        {
            PushArray(fieldName);

            // check the length.
            if (m_context.MaxArrayLength > 0 && m_context.MaxArrayLength < values.Count)
            {
                throw new ServiceResultException(StatusCodes.BadEncodingLimitsExceeded);
            }

            if (values != null)
            {
                for (int ii = 0; ii < values.Count; ii++)
                {
                    WriteUInt16(null, values[ii]);
                }
            }

            PopArray();
        }