C# Interactive Window in Visual Studio 2015 Update 1

The C# Interactive window has been made available again in Visual Studio with the first update to 2015, this time as a REPL window. You can type or paste and execute C# code, and it includes support for adding references to external DLLs and using namespaces. The window is intended for rapid prototyping C# code.

It is available from Views > Other Windows > C# Interactive.

Here is a simple example where we declare an integer variable, increment its value and then print it.

You can write any C# code including lambdas and LINQ queries.
You can also define types and write functions.

If you want to use a namespace you must use the using directive just as you do in C#.

For references to additional DLLs (whether from the framework or custom) you use the #r command specifying the path to the module.
After you referenced a module you can use its namespaces and the types available there.

For a list of all commands use the #help command.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.