• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

类型或命名空间名称'属性'不存在

用户头像
it1352
帮助1

问题说明

我想在我的项目中使用应用程序设置。

I'm trying to use application settings in my project.

当我尝试在项目下面的代码行,我得到一个错误。

When I try the following line of code in the project, I get an error.

TransferLogs.Properties.Settings.Default.ValleyLastRun = timeNow;

由此产生的错误是:

类型或命名空间名称'属性'不存在命名空间'Williams.TransferLogs存在(是否缺少程序集引用?)

The type or namespace name 'Properties' does not exist in the namespace 'Williams.TransferLogs' (are you missing an assembly reference?)

我定义为我的项目 - >属性 - >设置页面上的日期时间设置ValleyLastRun。我不知道我为什么不能引用我的项目设置

I have the setting "ValleyLastRun" defined as a DateTime on my Project->Properties->Settings page. I don't know why I can't reference the setting in my project.

下面是解决方案的窗口:

Here's the solution window:

学新通

正确答案

#1

的问题与您的资源文件。每默认的设置为内部产生的。您可以更改上面的设置下拉框。

The problem is related to your resource file. Per default the settings are generated as internal. You can change that in the dropdown box above the settings.

有有时这个类的构造函数的一个问题,因为它仍然是内部的。您可以手动更改,但设置的每个编辑之后将被重置为内部。

There is sometimes a problem with the constructor of this class because it remains internal. You can change that manually but after every edit of the Settings it will be reset to internal.

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tanhcfecbe
系列文章
更多 icon
同类精品
更多 icon
继续加载