private void AssertWrite() { if (!BaseStream.CanWrite) throw new InvalidOperationException ("Cannot write to stream"); }