Skip to main content
 首页 » 编程设计

c#之为什么程序集似乎被引用但实际上没有

2024年02月06日12zhwl

我正在从事 ASP.Net MVC 项目。 我在访问 System.Configuration.Configuration 类时遇到问题。 它说它不存在,尽管我可以引用 System.Configuration。

问题是我没有在项目中添加对 System.Configuration 程序集的引用。

谁能告诉我为什么智能感知仍然找到 System.Configuration 类。它是另一个默认程序集的一部分吗?

谢谢,

请您参考如下方法:

System.Configuration 是一个命名空间,而不是一个类。

System.Configuration 命名空间的某些类在 System.dll 程序集和 System.Configuration.dll 中定义。

例如 ConfigurationManager 是 System.Configuration.dll 的一部分

http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager(v=vs.110).aspx

而 UriSection 是 System.dll 的一部分