public void Deserialize(IDeserializer deserializer) { var stream = InternalStream; Code = deserializer.ReadInt(); var len = deserializer.ReadLong(); stream.SetLength(len); stream.Seek(0, SeekOrigin.Begin); while (stream.Position != stream.Length) { var read = deserializer.ReadBytes(Buffer, 0, BufferSize); stream.Write(Buffer, 0, read); } stream.Seek(0, SeekOrigin.Begin); }