What is the entry point of a WPF application?

后端 未结 4 825
长情又很酷
长情又很酷 2020-12-29 01:35

The Main method is the entry point of a C# console application. Thus, for example, if I have to start some threads or services, I will do it within the Ma

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-29 01:49

    For a WPF standalone application that is generated in Visual Studio using the New Project wizard, the entry point for the application is the Main function, defined in App.g.cs (generated code). In the default project, this is the public static void App.Main method.

    Check this

    In general, a .NET application will use as its entry point (first function called) any method named Main that has public/static access modifiers–no matter what class Main is located in.

    If your application has more than one class with a public static Main method, you’ll need to specify the entry point in the project properties dialog. In the Startup object dropdown, select the class that contains the Main method that should be called on startup.

提交回复
热议问题