public void DeserializeFrom(Stream stream) { byte[] bytes = new byte[4]; stream.Read(bytes, 0, 4); count = Int32Serializer.FromBytes(bytes); stream.Read(bytes, 0, 4); int length = Int32Serializer.FromBytes(bytes); _data = new byte[length]; stream.Read(_data, 0, length); }
public void SerializeTo(Stream stream) { stream.Write(Int32Serializer.ToBytes(count), 0, 4); stream.Write(Int32Serializer.ToBytes(_data.Length), 0, 4); stream.Write(_data, 0, _data.Length); }