【发布时间】:2009-05-29 07:10:14
【问题描述】:
[Visual Studio 2008]
我为控制台应用程序创建了一个新项目并将其修改为如下所示:
class Program
{
static void Main (string[] args) {
Thread.Sleep (2000);
}
}
然后我为 Windows 窗体应用程序创建了另一个项目并对其进行了修改:
static class Program
{
//[STAThread] commented this line
static void Main (string[] args) { //Added args
//Commented following lines
//Application.EnableVisualStyles ();
//Application.SetCompatibleTextRenderingDefault (false);
//Application.Run (new Form1 ()); commented this line
Thread.Sleep (2000);
}
}
现在我既没有在第一个应用程序中编写控制台功能(Console.Write 等),也没有在第二个应用程序中编写与表单相关的操作。和我一模一样。
第一个应用程序仍然显示黑色窗口,第二个应用程序没有显示任何内容。是什么让它这样工作?
【问题讨论】:
-
您可以通过适当的编译器开关将任何项目类型编译为程序集。
标签: c# .net winforms visual-studio-2008 console-application