在C#.NET的应用程序和应用程序之间的区别是什么? [英] What is the difference between an App and Application in c#.net?

查看:271
本文介绍了在C#.NET的应用程序和应用程序之间的区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有在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

这篇关于在C#.NET的应用程序和应用程序之间的区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆