interviews.dotnetthread.com

↑ Grab this Headline Animator

Tuesday, September 16, 2008

How to read entire stream contents?

If you have a stream object (any of the stream like StreamReader, MemoryStream, FileStream) and you want to show its content, write following code.
// here theStream is the stream object
while (myStream.Position != myStream.Length)
{
Console.WriteLine("{0:x2}", myStream.ReadByte());
}

Submit this story to DotNetKicks

No comments:

Post a Comment

Post your comments/questions/feedback for this Article.

 

Latest Articles