Opc.Ua.Client.DataDictionary.ReadDictionary C# (CSharp) Method

ReadDictionary() private method

Reads the contents of a data dictionary.
private ReadDictionary ( NodeId dictionaryId ) : byte[]
dictionaryId NodeId
return byte[]
        private byte[] ReadDictionary(NodeId dictionaryId)
        {
            // create item to read.
            ReadValueId itemToRead = new ReadValueId();

            itemToRead.NodeId       = dictionaryId;
            itemToRead.AttributeId  = Attributes.Value;
            itemToRead.IndexRange   = null;
            itemToRead.DataEncoding = null;
            
            ReadValueIdCollection itemsToRead = new ReadValueIdCollection();
            itemsToRead.Add(itemToRead);
                        
            // read value.
            DataValueCollection values;
            DiagnosticInfoCollection diagnosticInfos;

            ResponseHeader responseHeader = m_session.Read(
                null,
                0,
                TimestampsToReturn.Neither,
                itemsToRead,
                out values,
                out diagnosticInfos);

            ClientBase.ValidateResponse(values, itemsToRead);
            ClientBase.ValidateDiagnosticInfos(diagnosticInfos, itemsToRead);      
      
            // check for error.
            if (StatusCode.IsBad(values[0].StatusCode))
            {
                ServiceResult result = ClientBase.GetResult(values[0].StatusCode, 0, diagnosticInfos, responseHeader);
                throw new ServiceResultException(result);
            }

            // return as a byte array.
            return values[0].Value as byte[];
        }