StreamReader Constructor (Stream)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Initializes a new instance of the StreamReader class for the specified stream.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- stream
- Type: System.IO.Stream
The stream to be read.
| Exception | Condition |
|---|---|
| ArgumentException | stream does not support reading. |
| ArgumentNullException | stream is Nothing. |
This constructor initializes the encoding to UTF8Encoding, the BaseStream property using the stream parameter, and the internal buffer to the default size.
The StreamReader object calls Stream.Dispose on the provided Stream object when StreamReader.Dispose is called.
Caution: |
|---|
When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown. |
Caution: