【发布时间】:2012-06-23 12:50:20
【问题描述】:
在 Visual Studio 2015 或更高版本中,我可以打开“C# 交互窗口”并运行代码:
> 5 + 3
8
真可爱。现在我如何与我的代码——我的类进行交互?假设我打开了一个项目。
> 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?)
【问题讨论】:
-
Roslyn 不是交互式窗口。它是 .NET 编译器 API。你确定没有错过吗?
-
这是 Roslyn blogs.msdn.com/b/csharpfaq/archive/2012/01/30/… 附带的一项功能
-
我总是为此使用标准的即时窗口 - 也适用于您自己的类型。
-
什么是“标准即时窗口”?
-
@MattHickford 查看我的更新答案以获取更多信息
标签: c# .net visual-studio roslyn