Paul <Pa**@discussions.microsoft.com> wrote:
How do I convert a System.IO.Stream to a string variable.
Do you mean you want to read the contents of a stream, decoding it into
a string, and storing the result in a variable? If so:
using (StreamReader reader = new StreamReader(stream))
{
string contents = reader.ReadToEnd();
}
Note that the above assumes an encoding of UTF-8. If you want a
different encoding, specify it in the StreamReader constructor.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog:
http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too