What benefits will I get from using ApplicationContext?

What is the difference between writing a program using ApplicationContext as follows:

 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); } } } 

and standard Main ?

 namespace Test { class Test { static void Main(string[] args) { //the program } } } 
+6
source share
1 answer

Let's say that you have common functions for one set of programs, and then some different functions for different programs, but both sets have some common functions. Using the class BaseContext : ApplicationContext , you can perform common functions for both, and then implement specific set functions, inheriting from BaseContext. Basically, you get the same benefits as from "normal" polymorphism.

+5
source

All Articles