在C#.NET的应用程序和应用程序之间的区别是什么?应用程序、区别、NET

2023-09-05 00:05:09 作者:比空白更空白的空白是人心

有没有在C#应用应用程序之间有什么区别?

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

我想使用 App.current.Resources ,其中在主 WPF 应用程序加载控件库。但它是不可能在一条笔直的路,但在同一时间,它是允许我使用 Application.current.Resources

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

谁能帮我理解这两者之间的基本区别。 有没有使用任何瑕疵 Application.Current.Resources 而不是 App.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?

推荐答案

应用是你应用程序默认的类名。它会在您的项目通过自动生成的code如下定义。

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

因此​​,我们确实都是一样的,你所访问的定义的静态当前属性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