gpt4 book ai didi

c# - 为什么没有 ConfigurationManager?

转载 作者:太空宇宙 更新时间:2023-11-03 19:48:21 27 4
gpt4 key购买 nike

我尝试使用 ConfigurationManager,起初 System.Configuration 没有,我想知道为什么。

enter image description here

经过一些尝试,在包含引用 System.Configuration 之后它现在显示了。

enter image description here

那么我如何在没有引用的情况下使用 System.Configuration 呢?但是需要引用才能使用System.Configuration.ConfigurationManager

enter image description here

最佳答案

在 .net1.0 和 1.1 中,命名空间 System.Configuration 位于 System.dll 下。
自 .net2.0 以来,有一个新程序集 - System.Configuration.dll

回到我们不得不使用 ConfigurationSettings 的日子,位于 System.dll 程序集中,现在已过时。
现在,我们正在使用 ConfigurationManager及其在 System.Configuration.dll 程序集中。

所以,您获得 System.Configuration 的原因可能是因为您正在引用默认情况下包含在 winforms 应用程序中的 System.dll

关于c# - 为什么没有 ConfigurationManager?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42702889/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com