Colonel Panic Colonel Panic - 1 month ago 15
C# Question

Can the C# interactive window interact with my code?

I installed Roslyn. Now, if I know where to look in Visual Studio, 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?)

Answer

You can use classes from your own project.
Just right click on your solution and select "Reset Interactive from Project".

If you need more information, here is the source:
Using the C# Interactive Window that comes with Roslyn – Part 2