/// <summary> /// Sets the data contained within this instance. /// </summary> /// <param name="buffer">An array of <see cref="byte"/> elements. This value can be <see langword="null"/>.</param> public void SetBuffer(byte[] buffer) { //Check if (buffer == null) { buffer = new byte[0]; } //Set data = (byte[])buffer.Clone(); //Dispose dataStream?.Dispose(); dataStream = new VirtualStream(data); }
/// <summary> /// Releases all resources used by this instance. /// </summary> public void Dispose() { if (IsDisposed) { return; } IsDisposed = true; dataStream.Dispose(); dataStream = null; }
void IDisposable.Dispose() { _stream.Dispose(); }