protected MemoryStream CreateMemoryStreamWithWriteTo(long?length) { MemoryStream temp; if (length.HasValue) { temp = new MemoryStream(checked ((int)length.Value)); } else { temp = new MemoryStream(); } var ignore = new IgnoreCloseStream(temp); this.WriteTo(ignore, length); ignore.Flush(); temp.Position = 0; return(temp); }
protected MemoryStream CreateMemoryStreamWithWriteTo(long? length) { MemoryStream temp; if (length.HasValue) { temp = new MemoryStream(checked((int)length.Value)); } else { temp = new MemoryStream(); } var ignore = new IgnoreCloseStream(temp); this.WriteTo(ignore, length); ignore.Flush(); temp.Position = 0; return temp; }