What's the Windows IDE for writing, running, and debugging single-file programs in C #?

I am using Visual Studio 2010 for C # development. But there are many times throughout the day where I need to quickly try a little C # code to experiment or learn something new. I can write this as a fully functional C # program in one file . Now I can use Visual Studio to write / edit these C # files, but it doesn't support execution or debugging (breakpoint, observable variables) unless I build a solution for it.

I would like to be able to build , edit , execute (and hopefully debug ) C #, without having to go through all the effort of building a VS solution every time I need to try something. Is there a simple C # IDE on Windows where I can do this?

There should be no project / solution files in the IDE. That way, I can have a directory of C # files, each of which is a complete C # program, and each of which I can open for reading, editing, and execution with this IDE anytime I want.

+3


source to share


3 answers


LinqPad can execute expressions, statements, or small programs that can be the same file size (see also this page ). It doesn't create project / solution files in the same way you are looking for. Just open, code and save if you like. I am using the free version to test the code that I post on this site.



It supports .Net 4.0 and has some other nice features like no need to explicitly specify the use of operators. The program is smart enough to know which ones you need.

+9


source


Try Snippet Compiler



enter image description here

+4


source


In the next version of C # and Visual Studio, one of the new features is Project Roslyn , an implementation of the compiler as a service.The result is that this includes scripts in C # with .csx files. The Visual Studio blog has a lot more information on .csx files here .

I haven't played with .csx files myself much, but they are similar to .fsx files for F # scripts in that you take the code you would normally put inside a method (in F #, a function) and place it at the top level and can use a hash to represent compiler directives (like #r for DLL reference).

+1


source







All Articles