DEV Community

loading...

C# REPL using mono or dotnet-script

Galdin Raphael
Software developer. When not writing code, I'm probably reading a book, playing the piano or studying music theory.
Originally published at gldraphael.com on ・1 min read

Quite often, all I want to do is check if a single line of code does what I think it does. I've always been a huge fan of LinqPad for a use-case like this. But it's Windows-only and that's a bummer since I do most of my development on a Macbook.

I began googling around a few days back and was pleasantly surprised to find two great options:

The mono-tools csharp REPL

  1. Install mono.
  2. Type csharp in your terminal to start a REPL.

Here's what it looks like:

The REPL is documented here.

The .NET Core dotnet-script global tool

  1. Install .NET Core.
  2. Install the global tool using dotnet tool install -g dotnet-script.
  3. Type dotnet script in your terminal.

Here's what it looks like:

This tool covers a lot of use-cases beyond a basic REPL and they're all documented in its GitHub repo.

For me though, a simple REPL with intellisense is all I want!

Discussion (0)