In Visual Studio 2015 or later, I can open the 'C# interactive window', and run code:
> 5 + 3
8
That's cute. Now how can I interact my code—my classes? Assume I have a project open.
> new Cog()
(1,5): error CS0246: The type or namespace name 'Cog' could not be found (are you missing a using directive or an assembly reference?)
When using Visual Studio 2015:
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:
You can also use the Immediate Window to interact with your code as well, like so: