8

I want to learn C# on a Debian system.

What do I have to install?

Is there something like an interactive prompt where I can try running snippets of code?

I have to learn C# and I have a dual boot computer, but don't feel like powering off Linux and booting Windows just for learning C#.

Kusalananda
  • 333,661
Pierre B
  • 2,213

2 Answers2

14

What do I have to install?

apt install mono-mcs

and optionally

apt install monodevelop

if you want something more like an IDE.

mcs is the compiler. You can run the compiled program with mono prog.exe (or as ./prog.exe with binfmt_misc support enabled, which I believe Debian will do by default).

Is there something like a prompt where I can try running snippets of code?

apt install mono-csharp-shell

and then

$ csharp
Mono C# Shell, type "help;" for help

Enter statements below.
csharp> Console.WriteLine("Hello world!")
Hello world!
csharp>
Michael Homer
  • 76,565
1

To complement the previous answer, there's also the .NET Core SDK, which is has a faster and cleaner implementation of the .NET framework(albeit it's somewhat imcomplete, being a Core CLR. Still really reliable, though). If you don't need C# for WinForms, UWP and WPF development, I really recommend checking it out. By now, most libraries should be supporting .NET Core. Download link: https://dotnet.microsoft.com/download

As for the IDE, there's VS Code, which is the one I'm currently using, and JetBrains Rider. MonoDevelop does have an addon for NET Core support, but I heard it's lacking features(especially on the debug department).