This documentation is archived and is not being maintained.

CryptoStream.Write Method

Writes a sequence of bytes to the current CryptoStream and advances the current position within this stream by the number of bytes written.

[Visual Basic]
Overrides Public Sub Write( _
   ByVal buffer() As Byte, _
   ByVal offset As Integer, _
   ByVal count As Integer _
public override void Write(
 byte[] buffer,
 int offset,
 int count
public: void Write(
 unsigned char buffer __gc[],
 int offset,
 int count
public override function Write(
   buffer : Byte[],
 offset : int,
 count : int


An array of bytes. This method copies count bytes from buffer to the current stream.
The byte offset in buffer at which to begin copying bytes to the current stream.
The number of bytes to be written to the current stream.


Exception Type Condition
NotSupportedException The current stream is not writable.
ArgumentOutOfRangeException The offset parameter is less than zero.


The count parameter is less than zero.

ArgumentException Thesum of the count and offset parameters is longer than the length of the buffer.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

CryptoStream Class | CryptoStream Members | System.Security.Cryptography Namespace | Cryptographic Services