Posted by Anuraj on Wednesday, April 13, 2016 Reading time :1 minute
Visual Studio 2015 update 1 comes with C# interactive window. C# interactive window is a read-eval-print-loop (REPL) with advanced editor support. It supports features like IntelliSense as well as the ability to redefine functions & classes. After entering a code snippet–which can contain class and function definitions at top-level along with statements–the code executes directly.
You need VS 2015 update 1 or update 2 to use this feature. Once you have one of these versions installed, navigate to View > Other Windows > C# Interactive. This will bring up the Interactive Window.
Now you can type any valid C# expression or statement and press Enter to evaluate. In the above image, using a C# expression, which will print the result. You can create methods in C# interactive window either typing the whole function or by pasting it.
If you want to load another assembly to the C# interactive window, you can do this using #r command. Here I am loading a math assembly and I am executing a function inside it.
Happy Programming :)