Is there any way to run C# from the command line in interactive mode?

Asked

Viewed 153 times

10

I’m used to using PHP and Python, languages that allow you to run on the command line in interactive mode, so it’s easier to test or learn something new, since I won’t need to compile all the time (as it is in the case of C#).

Is there any way to use C# on the command line in interactive mode?

For example, in Python I can do this:

$ python
>>> 1 + 2
>>> # 3

The answer may be to the Windows, but if you have any way of doing Linux, would be grateful for a solution.

I use Ubuntu 14.04 operating system.

2 answers

9


There have been a few options for quite some time now official component working together with Visual Studio 2015 Update 1 forward (but you don’t need it to work). More information on Scott Hanselman’s blog.

It’s supposed to work with. NET Core on Linux, but I have no information on how the support is, if it needs any additional effort or is ready to use.

Article in MSDN Magazine.

Other options (some only online):

Some people still like the REPL from Linqpad.

  • Interesting is that in my Ubuntu was installed a command csharp and I didn’t know. It also serves +1

  • @Wallacemaxters there I don’t know, I only know the csi which is REPL on Windows when install all.

  • I’m confused, I don’t know if he installed how mono-complete, dnx or dotnet core (that link you gave me)

  • 1

    @Wallacemaxters look like Mono.

  • Until now I didn’t know what REPL was, it would give a good question, kkkkkk

6

There is, in Visual Studio 2015 there is an official component to this.

Just get in View > Other windows > C# interactive that a panel will be opened.

Source

Browser other questions tagged

You are not signed in. Login or sign up in order to post.