Exemple #1
0
        public static IDictionary <string, object> ReadMap(NetworkBinaryReader reader)
        {
            int entryCount = BytesWireFormatting.ReadInt32(reader);

            if (entryCount < 0)
            {
                string message = string.Format("Invalid (negative) entryCount: {0}", entryCount);
                throw new ProtocolViolationException(message);
            }

            IDictionary <string, object> table = new Dictionary <string, object>(entryCount);

            for (int entryIndex = 0; entryIndex < entryCount; entryIndex++)
            {
                string key   = StreamWireFormatting.ReadUntypedString(reader);
                object value = StreamWireFormatting.ReadObject(reader);
                table[key] = value;
            }

            return(table);
        }
 /// <summary>
 /// Reads an <see cref="object"/> from the message body.
 /// </summary>
 public object ReadObject()
 {
     return(StreamWireFormatting.ReadObject(Reader));
 }