Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

c#
visual studio
repl
communitycreator

How to launch a C# REPL or interactive compiler in Visual Studio

Surabhi Sharma

Microsoft Visual Studio is the most popular and powerful Integrated Development Environment(IDE) from Microsoft and is loaded with many features to enhance developer productivity. REPL is one such important feature. Since the VS2015 release, REPLor interactive compiler has been part of Visual Studio.

What is REPL?

REPL stands for Read-Evaluate-Print-Loop. It is basically an interactive shell that allows the programmer to run their code and see the output without compiling quickly. The Read-Eval-Print cycle is faster than the Edit-Compile-Execute cycle.

How to launch C# REPL in Visual Studio

Click on the View menu from the Menu bar, go to the Other windows menu item, and click on C# interactive.

Launching REPL from View Menu
Launching REPL from View Menu
  • The interactive compiler or REPL is launched as a Tab in Visual Studio. You can type #help to get all the important keyboard shortcuts, commands, and script directives:
C# Interactive Compiler
C# Interactive Compiler
  • Another way to launch the interactive compiler is to click or select a piece of code or a file and right-click and select Execute in Interactive from the context menu. The default Keyboard shortcut for the same operation is Ctrl+E, Ctrl+E.
Executing Code in REPL via context menu
Executing Code in REPL via context menu

C# REPL features

  • IntelliSense is supported in the interactive compiler.
  • We can load an assembly and call its methods using the #r command, which has important features like resetting the environment, clearing the REPL window, and maintaining all executed statements.
  • It supports error handling at compile and run time.

RELATED TAGS

c#
visual studio
repl
communitycreator
RELATED COURSES

View all Courses

Keep Exploring