JetBrains Rider
 
Get JetBrains Rider
You are viewing the documentation for an earlier version of JetBrains Rider.

C# Interactive

Last modified: 21 June 2022

JetBrains Rider includes a Read–Eval–Print Loop (REPL), which lets you experiment with C# code without compiling it.

As soon as the C# Interactive is started, you can write any C# expressions and evaluate them by pressing Enter.

https://resources.jetbrains.com/help/img/rider/2023.1/using-repl.png
Gif

All expressions that you execute during the session are recorded in history. To find a previously executed statement, use the Up/Down buttons or click Replay recent commands App vcs history and choose the one you need.

If your experiments resulted in some useful code, you can create a new scratch file with the full transcript of the session. To do so, click Export transcript to scratch file Icon export on the toolbar.

On Windows, JetBrains Rider will automatically detect and use the csi.exe executable that ships with MSBuild. On Mac OS X and Linux, JetBrains Rider defaults to Mono’s csharp. In case JetBrains Rider cannot find the correct executable or if you want to use another JetBrains Rider REPL, you can customize the tool path (and arguments) on the Languages & Frameworks | C# Interactive page of JetBrains Rider settings Ctrl+Alt+S.