private object InternalReadValue(Type type)
 {
     if (type == typeof(string))
     {
         return(m_reader.ReadString());
     }
     if (type == typeof(string[]))
     {
         return(MessageUtil.ReadStringArray(m_reader));
     }
     if (type == typeof(bool))
     {
         return(m_reader.ReadBoolean());
     }
     if (type == typeof(int))
     {
         return(m_reader.ReadInt32());
     }
     if (type == typeof(Stream))
     {
         m_lastStream = new LengthEncodedReadableStream(m_reader);
         return(m_lastStream);
     }
     if (type == typeof(Dictionary <string, object>))
     {
         return(ReadDictionary());
     }
     throw new NotImplementedException();
 }
 public void Dispose()
 {
     if (m_lastStream != null)
     {
         m_lastStream.Dispose();
         m_lastStream = null;
     }
 }
 private void VerifyLastStream()
 {
     if (m_lastStream != null)
     {
         if (!m_lastStream.Closed)
         {
             throw new InvalidOperationException("last stream");
         }
         m_lastStream = null;
     }
 }