c# convert console.writeline to a string -


i want code takes text written on console , put on string variable, plz. this:

string s = console.writeline(invoke(o, null)); 

i want console because if invoke without can't text it.

i hope understand it.

you can't directly. think can somehow getting console window object or that, it's not worth time when want output of console.writeline.

there lot of overloads of console.writeline, in end overloads convert parameter string, using tostring. so, put output of console.writeline in string variable, call tostring on argument.

string s = invoke(o, null).tostring(); 

what if want both print, and store output? can this:

string s = invoke(o, null).tostring(); console.writeline(s); 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -