我不想下载Visual Studio 2010.
我怎样才能开始学习(不是 开发实际应用程序)C#4.0 和.NET 4.0只有一个文本 编辑器?
我可以下载C#4.0编译器吗? 和.NET 4.0框架并得到 开始了吗?怎么样?
我有Visual Studio 2008,但我从SO问题中学到它无法完成这项工作。
答案 0 :(得分:4)
C#编译器是.NET Framework的一部分。
您可以在C:\ Windows \ Microsoft.NET \ Framework \ your_version_number \ csc.exe下找到它
因此,只需打开文本编辑器,编写源代码,然后使用命令行编译器进行编译。
答案 1 :(得分:3)
答案 2 :(得分:2)
使用command line compiler。大多数文本编辑器都可以让您轻松搞定。
答案 3 :(得分:1)
您需要.NET framework 4.0(如果已存在)。编译器是.NET包的一部分。
编辑:刚刚检查过,.NET框架处于测试版2阶段。不会去那里。
答案 4 :(得分:1)
首先去下载beta 2 of the .NET framework 4(撰写本文时的当前内容)。
现在,确保C:\Windows\Microsoft.NET\Framework\v4.0.21006\
在您的PATH环境变量中。
以下是command-line compiler的MSDN页面,以便您查看选项。对于简单的事情,它通常归结为:
// compile an executable
$ csc /out:App.exe *.cs
// compile a library
$ csc /target:library /out:Lib.dll *.cs
// compile with a reference to System.Core.dll
$ csc /out:App.exe /r:System.Core.dll *.cs
// compile with a reference to Microsoft.CSharp.dll (you might need this to use dynamic)
$ csc /out:App.exe /r:Microsoft.CSharp.dll *.cs
当然尝试使用带语法高亮的编辑器。我相信C#4只引入了三个新的关键字,所以即使版本3突出显示(in
和out
已经存在,你也应该没问题,但它们现在在新的上下文中有效且{{1} }是全新的。)