English 中文(简体)
Howto get started with C# 4.0 and .NET 4.0?
原标题:

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.

最佳回答
问题回答

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

You can find it under C:WindowsMicrosoft.NETFrameworkyour_version_numbercsc.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:WindowsMicrosoft.NETFrameworkv4.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).





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签