Using script directives and REPL commands in the C# interactive window
In this section, we will walk you through the common directives and REPL commands available in C# interactive scripting and show you how to use them in the Visual Studio interactive window.
Getting started
You will need to have the Visual Studio 2017 Community edition installed on your machine to execute this recipe. You can install a free community edition from https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Community&rel=15.
How to do it...
- Open Visual Studio and start the
C# Interactive
window by clicking onView |
Other Windows |
C# Interactive.
- Copy
Newtonsoft.Json.dll
from the attached sample for the recipe into your temp directory%TEMP%
. - Execute the following
#r
directive to load this assembly into the interactive session:
#r "<%YOUR_TEMP_DIRECTORY%>\Newtonsoft.Json.dll"
- Verify that you can now reference types from this assembly as well as create objects and invoke methods. For example, type...