Can the C# interactive window interact with my code?

When using Visual Studio between 2015 and 2022:

You can open the Interactive window by navigating to Views > Other Windows > C# Interactive,

Then just right click your project and run Initialize Interactive with Project from the context menu.


For older versions:

To use the C# Interactive Window with your code, ensure you first compile your code, then add a reference to the resulting assembly with the #r command like so:

C# command prompt


You can also use the Immediate Window to interact with your code as well, like so:

Immediate Window

Leave a Comment