2 min read
Introduction to C# REPL

#

C# REPL (Read, Evaluate, Print, Loop) wiki

image.png

Have you ever run into a situation where you need to run some code segments without adding it to your current solution?? The simple solution is quickly creating a new solution with a console app to test these codes.

Or you ever wanted to generate a random string or integer or a more practical one, a guid (This happens to me a lot personally).

Introducing CSharpREPL, a tool that allows developers run C# as an interpreted language. If you’re a dev coming from languages like Python or javascript, tools like this look familiar and natural.

From the docs github repo:

A cross-platform command line REPL for the rapid experimentation and exploration of C#. It supports IntelliSense, installing NuGet packages, and referencing local .NET projects and assemblies.

Installation (from nuget):


Type this on your console dotnet tool install -g csharprepl

Basic Usage


> Console.WriteLine("Hello Revent!")
Hello Revent!
> DateTime.Now
21/09/2024 10:29:17
> Guid.Empty
00000000-0000-0000-0000-000000000000
> Guid.NewGuid()
64f55d76-7451-4c85-a315-7e4bddf19ed0

More detailed instructions here