Question

I don't want to download Visual Studio 2010.

  1. How can I start studying (not developing real applications) C# 4.0 and .NET 4.0 with just a text editor?

  2. Can I just download C# 4.0 compiler and .NET 4.0 framework and get started? How?

I have got Visual Studio 2008 but I learn from SO questions that it can't do the job.

Was it helpful?

OTHER TIPS

The C# compiler is part of the .NET Framework.

You can find it under C:\Windows\Microsoft.NET\Framework\your_version_number\csc.exe

So, just open a text editor, write your source code, and compile it with the command line compiler.

Use the command line compiler. Most text editors let you hook into this easily.

You need .NET framework 4.0 (if it exists already). Compiler is part of .NET package.

Edit: Just checked and .NET framework is in beta 2 stage. Wouldn't go there just yet.

First go and download the beta 2 of the .NET framework 4 (current at the time of this writing).

Now, make sure C:\Windows\Microsoft.NET\Framework\v4.0.21006\ is in your PATH environment variable.

Here's the MSDN page for the command-line compiler so you can see the options. For simple things it usually boils down to this:

// 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

Of course try to use an editor with syntax highlighting. I believe C# 4 only introduces three new keywords, so you should be fine even with highlighting for version 3 (in and out already existed, but they are now valid in a new context and dynamic is entirely new).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top