Exemple #1
0
        public static List <T> Deserialize(Stream bytes, Deserializer <T> serialization)
        {
            ushort   length = UInt16Proxy.Deserialize(bytes);
            List <T> list   = new List <T>(length);

            for (int i = 0; i < length; i++)
            {
                list.Add(serialization(bytes));
            }

            return(list);
        }
Exemple #2
0
        public static string Deserialize(Stream bytes)
        {
            ushort length = UInt16Proxy.Deserialize(bytes);

            if (length > 0)
            {
                byte[] buffer = new byte[(length * 2)];
                bytes.Read(buffer, 0, buffer.Length);

                return(Encoding.Unicode.GetString(buffer, 0, buffer.Length));
            }
            return(string.Empty);
        }