Pet*_*ter 5 c# appsettings winforms
我有一个winforms应用程序,其中一些数据存储在XML文件中.应存储这些XML文件的位置可由用户配置,并存储在AppSettings中.我的所有图层都是单独的组件.我可以从我的DAL程序集中访问我的设置,还是应该将其作为参数传递到我的所有图层?
当我尝试从DAL层读取设置时,我遇到了另一个问题
Configuration config = ConfigurationManager.OpenExeConfiguration(
System.Reflection.Assembly.GetEntryAssembly().Location);
string dataStorageLocation = config.AppSettings["DataStorageLocation"];
Run Code Online (Sandbox Code Playgroud)
config.AppSettings ["DataStorageLocation"]给出编译错误:System.Configuration.ConfigurationElement.this [System.Configuration.ConfigurationProperty]由于其保护级别而无法访问.这是为什么?
有人能让我走上正轨吗?谢谢.
| 归档时间: |
|
| 查看次数: |
6062 次 |
| 最近记录: |