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

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -