Opc.Ua.XmlDecoder.ReadInt16Array C# (CSharp) Method

ReadInt16Array() public method

Reads a short array from the stream.
public ReadInt16Array ( string fieldName ) : Int16Collection
fieldName string
return Int16Collection
        public Int16Collection ReadInt16Array(string fieldName)
        {
            bool isNil = false;

            Int16Collection values = new Int16Collection();
                                    
            if (BeginField(fieldName, true, out isNil))
            {                                
                PushNamespace(Namespaces.OpcUaXsd);
                
                while (MoveToElement("Int16"))
                {
                    values.Add(ReadInt16("Int16"));
                }

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

                PopNamespace();

                EndField(fieldName);
                return values;
            }

            if (isNil)
            {
                return null;
            }

            return values;
        }