public override void Flush()
{
lock (this.syncLock)
{
if (Length == 0)
return;
WaitOnPendingFlush();
this.asyncResult = this.stream.BeginWrite(bufferStream.GetBuffer(), 0, (Int32)Length, result => WaitOnPendingFlush(), null);
bufferStream.Position = 0;
bufferStream.SetLength(0);
}
}