Experimenting with C# Interactive

Although Visual Studio has always had an Immediate window with limited Read-eval-print loop (REPL) support, Visual Studio 2017 includes an enhanced window with full IntelliSense and color syntax code named C# Interactive.

In Visual Studio 2017, navigate to View | Other Windows | C# Interactive.

We will write some interactive code to download the About page from Microsoft's public website.

This is just an example. You don't need to understand the code yet!

At the C# Interactive prompt, we will enter commands to do the following:

  • Reference the System.Net.Http assembly
  • Import the System.Net.Http namespace
  • Declare and instantiate an HTTP client variable
  • Set the client's base address to Microsoft's website

Get C# 7.1 and .NET Core 2.0 – Modern Cross-Platform Development - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.