How to quickly code and run small C# code

后端 未结 19 1596
再見小時候
再見小時候 2021-01-31 01:46

There are times when I want to test new code from the forums or when I need to help my friends with specific C# problem. The problem is I don\'t want to create new \"project\" i

相关标签:
19条回答
  • 2021-01-31 01:46

    This is something I've never liked about visual studio. One thing (and probally the only thing) I miss from VB6 was the ability to create a project, and run it without saving it or anything. Was great for just what you said.

    I typically have at least one or two scrap projects of each type, (Console, Winforms, and Web), that I just rotate and use. This way I'm not always creating new projects.

    0 讨论(0)
  • 2021-01-31 01:47

    I just use the scratch console application project that I've defined for just this purpose. I cut out whatever is in the main program and go to town. If I decide that I need to keep whatever I've prototyped, I create a new project and copy to it. Since I do this all the time, the project's always in my recent-projects list, too.

    0 讨论(0)
  • 2021-01-31 01:47

    I use a batch file (csc.bat):
    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc %1 %2 %3 %4 %5 %6 %7 %8 %9

    For vb.net I use this batch file(vbc.bat):
    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\vbc %1 %2 %3 %4 %5 %6 %7 /r:system.windows.forms.dll /r:system.data.dll /r:system.dll

    For example: C:>csc testit.cs

    Each will create a .net .exe file. This solution is not so good for Windows Forms applications, however.

    0 讨论(0)
  • 2021-01-31 01:48

    Check also Snippy and the Snippy Addin for Reflector

    0 讨论(0)
  • 2021-01-31 01:48

    There is an online web C# compiler and executor: http://www.compileonline.com/compile_csharp_online.php

    0 讨论(0)
  • 2021-01-31 01:49

    I usually use csc directly from the command line

    C:\Users\Greg>csc /o- /debug+ Test.cs

    0 讨论(0)
提交回复
热议问题