简体   繁体   中英

What is the difference between an App and Application in c#.net?

Is there any difference between App and Application in c#?

I am trying to use App.current.Resources in control library which is loaded in main WPF application. But it is not possible in a straight way, but at the same time it is allowing me to use Application.current.Resources

Could anyone help me to understand the basic differences between these two. Is there any flaw on using Application.Current.Resources instead of App.current.Resources ?

App is the default class name for your Application . It will be defined in your project by autogenerated code as follows.

public partial class App : Application

So indeed both are same, You're accessing static Current property defined in Application class only.

Application.Current.Resources//Accessing current through base class
App.Current.Resources//Accessing current through derived class

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM