Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to automatically output value in C# Interactive (REPL) like Immediate does?

Tags:

I started using C# Interactive and like the fact that I can browse and explore some API functionalities like I do with Immediate without the need to run and debug my program.

The problem is that it does not output the info like Immediate does unless I do a command with a variable name:

 > string.Format("{0,15}", 10m);         //hit enter, here there is no output  > var a = string.Format("{0,15}", 10m); //hit enter so...  > a                                     // hit enter and...   "        10"                           //...here the value is shown  > 

Is there a way to make C# Interactive output the values in every evaluation like Immediate does (And without write more code for that like Console.Write)?

like image 493
Vitor Canova Avatar asked Feb 17 '16 13:02

Vitor Canova


1 Answers

Yes, to output the result of an evaluated expression simply do not put a semicolon at the end. In your example, instead of this:

string.Format("{0,15}", 10m); 

do this:

string.Format("{0,15}", 10m) 

See the documentation

like image 137
Crowcoder Avatar answered Oct 07 '22 17:10

Crowcoder