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

angular - DownloadURL return null in below code -

python 2.7 - Given three nested dictionaries, sort the top two nested dictionaries from a value in the innermost dictionary? -