Introduction
This chapter gives a basic introduction to one of the most powerful features/tools based on the Roslyn compiler API: C# interactive and scripting. You can read an overview about C# scripting at https://msdn.microsoft.com/en-us/magazine/mt614271.aspx. Here is a small gist of this feature from the preceding article:
C# scripting is a tool for testing out your C# and .NET snippets without the effort of creating multiple unit testing or console projects. It provides an easy means to explore and understand an API without the overhead of a yet another CSPROJ
file in your %TEMP%
directory. The C# read-evaluate-print-loop (REPL) is available as an interactive window within Visual Studio 2015 and after and as a new command-line interface (CLI) called CSI.
Here is a screenshot of the C# interactive window in Visual Studio:
The following is a screenshot of the C# interactive command-line interface (csi.exe
) executed from a Visual Studio 2017 developer command prompt: