FlushFinalBlock Method

CryptoStream.FlushFinalBlock Method ()


Updates the underlying data source or repository with the current state of the buffer, then clears the buffer.

Namespace:   System.Security.Cryptography
Assembly:  mscorlib (in mscorlib.dll)

public void FlushFinalBlock()

Exception Condition

The key is corrupt which can cause invalid padding to the stream.


The current stream is not writable.


The final block has already been transformed.

Calling the Close method will call FlushFinalBlock. If you do not call Close, call FlushFinalBlock to complete flushing the buffer. Call FlushFinalBlock only when all stream activity is complete.

.NET Framework
Available since 1.1
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
© 2015 Microsoft