plz guide me how can I view the content of a memory stream
in visual studio output window....? I know the encoding is utf-8..

plz help...

Recommended Answers

You could do this:

using System;
using System.Diagnostics;
using System.IO;

namespace DW_404824_CS_CON2
{
   class Program
   {
      static void Main(string[] args)
      {
         MemoryStream fileMem = new MemoryStream(new byte[] {5,1,2,3,4});
         int i = 0;

         while (-1 != (i = fileMem.ReadByte()))
         {
            //Console.WriteLine(i);
            Trace.WriteLine(i);
         }

         fileMem.Close();
      }
   }
}
Jump to Post

All 3 Replies

You could do this:

using System;
using System.Diagnostics;
using System.IO;

namespace DW_404824_CS_CON2
{
   class Program
   {
      static void Main(string[] args)
      {
         MemoryStream fileMem = new MemoryStream(new byte[] {5,1,2,3,4});
         int i = 0;

         while (-1 != (i = fileMem.ReadByte()))
         {
            //Console.WriteLine(i);
            Trace.WriteLine(i);
         }

         fileMem.Close();
      }
   }
}

For more on the MemoryStream class, you can view this.

thanks alot... it works...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.