Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

CryptoStream.Read Method

Reads a sequence of bytes from the current CryptoStream and advances the position within the stream by the number of bytes read.

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

public override int Read (
	[InAttribute] [OutAttribute] byte[] buffer,
	int offset,
	int count
)
public int Read (
	/** @attribute InAttribute() */ /** @attribute OutAttribute() */ byte[] buffer, 
	int offset, 
	int count
)
public override function Read (
	buffer : byte[], 
	offset : int, 
	count : int
) : int
Not applicable.

Parameters

buffer

An array of bytes. A maximum of count bytes are read from the current stream and stored in buffer.

offset

The byte offset in buffer at which to begin storing the data read from the current stream.

count

The maximum number of bytes to be read from the current stream.

Return Value

The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero if the end of the stream has been reached.
Exception typeCondition

NotSupportedException

The CryptoStreamMode associated with current CryptoStream object does not match the underlying stream. For example, this exception is thrown when using Read with an underlying stream that is write only.

ArgumentOutOfRangeException

The offset parameter is less than zero.

-or-

The count parameter is less than zero.

ArgumentException

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

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.