private void EnsureCanWrite() { Debug.Assert(_stream != null); if (!_stream.CanWrite) throw new NotSupportedException(SR.NotSupported_UnwritableStream); }