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
Post a Comment