public override int Read(byte[] buffer, int offset, int count) { if (this.currentBlockNode == null || this.currentBlockNode.Value == null) { return(0); } SampleBlock block = this.currentBlockNode.Value; int bytesAvailableInCurrentBlock = block.BytesInUse - this.positionInBlock; int bytesCopied = Math.Min(bytesAvailableInCurrentBlock, count); block.CopyTo(this.positionInBlock, buffer, offset, bytesCopied); this.positionInBlock += bytesCopied; this.position += bytesCopied; if (block.BytesInUse <= this.positionInBlock) { this.currentBlockNode = this.currentBlockNode.Next; this.positionInBlock = 0; int bytesRemainingToCopy = count - bytesAvailableInCurrentBlock; if (bytesRemainingToCopy > 0) { bytesCopied += this.Read(buffer, offset + bytesCopied, bytesRemainingToCopy); } } return(bytesCopied); }