public static byte[] DeserializeArray(Stream bytes) { int length = Int32Proxy.Deserialize(bytes); byte[] buffer = new byte[length]; bytes.Read(buffer, 0, length); return(buffer); }
public static Dictionary <TKey, TValue> Deserialize(Stream bytes, Deserializer <TKey> keySerialization, Deserializer <TValue> valueSerialization) { int length = Int32Proxy.Deserialize(bytes); var dictionary = new Dictionary <TKey, TValue>(length); for (int i = 0; i < length; i++) { dictionary.Add(keySerialization(bytes), valueSerialization(bytes)); } return(dictionary); }