C# How do I export a MemoryStream's content to the console and write the stream's content onto the console? -


the title says pretty all.

i making logging system using "debug" class (debug.writeline, etc.), , i've attached textwritertracelistener can log strings has been written using debug write functions.

e.g:

memorystream stream = new memorystream(); textwriter standardoutput = new streamwriter(stream); textwritertracelistener writer = new textwritertracelistener(standardoutput); debug.listeners.add(writer); debug.writeline("123 test"); console.writeline("hi there!"); //*here add existing data in stream ('stream')* 

any idea how achieve this?

instead of manually created memorystream use console.out represents standard output stream:

textwritertracelistener writer = new textwritertracelistener(console.out); debug.listeners.add(writer); 

Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -