如何在应用程序配置文件中存储类对象 [英] How to store class object in app config file

查看:150
本文介绍了如何在应用程序配置文件中存储类对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windows应用程序有多个窗体。从一种形式在应用程序中显示另一种形式。在第一种形式中,我为一个类创建了一个对象(在所有表单之间有共同的信息)。我想在所有其他形式使用相同的对象。

I have a windows application which has more than one form. From one form another form is shown in the application. In the first form, I am creating an object for a class( which has common info among all the forms). I want to use the same object in all the other forms.

我可以在第一种形式的App.Config文件中保存类对象,并以其他形式检索它吗?如果是这样,请告诉我的方法,如果不是,建议任何好的方法来实现这一点。

Can I save the class object in App.Config file in the first form and retrieve it in other forms? If so please tell me the way to do and If not, suggest any good way to achieve this.

感谢提前

推荐答案

您可以创建一个具有静态属性的静态类,并根据需要引用它。

You can create a static class having static properties and refer to it whereever required.

这篇关于如何在应用程序配置文件中存储类对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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