使用这样的ApplicationContext编写程序有什么区别:
using System;
using System.Windows.Forms;
namespace Test
{
class Test
{
static void Main(string[] args)
{
Application.Run(new Context(args));
}
}
class Context : ApplicationContext
{
public Context(string[] args)
{
//the program
Environment.Exit(1);
}
}
}和标准Main
namespace Test
{
class Test
{
static void Main(string[] args)
{
//the program
}
}
}发布于 2014-04-29 21:41:44
假设您对一组程序有共同的特性,然后对于不同的程序集有一些不同的特性,但是这两组都有一些共同的功能。通过使用class BaseContext : ApplicationContext,您可以对两者执行共同的功能,然后通过从BaseContext继承来实现特定的集功能。基本上,你从“正常”多态性中得到的好处与‘正常’多态性相同。
https://stackoverflow.com/questions/23368757
复制相似问题