Question

I'm a beginner in C# and trying to use Sublime Text for my editor. But the default console doesn't seem to support "Console.ReadLine();" I can't find anywhere that I can type my input with.

I searched some plug-ins, and found this REPL and CSharpreter. However, REPL doesn't seem to support C#

enter image description here

and even when I try to load other languages, error message like this pops up.

enter image description here

What can be a good solution? Please help!

Was it helpful?

Solution

You're looking for a combination of scriptcs, scriptcs-sublime and SublimeREPL. They will let you write and execute C# code inside Sublime Text easily.

Steps to install:

  1. Install chocolatey (like apt-get for Windows) by running the following PowerShell command:

    @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin

  2. Install scriptcs by running the following command in your CLI

    cinst scriptcs

  3. Install Sublime Package Control (if you don't have it already). You can find the installation guide here.

  4. Go to Menu > Tools > Command Palette and type Install Package, then find and install

    1. scriptcs
    2. SublimeREPL
  5. Restart Sublime

  6. Go to Menu > Tools > Command Palette and select SublimeREPL: ScriptCS.

You should now be running the scriptcs REPL inside Sublime Text :)

scriptcs REPL in Sublime

OTHER TIPS

If you want to develop C# code, MS Visual Studio is best way to do it.

It has also express edition which is free.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top