.net - 从字符串加载配置

标签 .net configuration-files

我想从xml字符串或流而不是文件创建Configuration对象。但据我所知,ConfigurationManager需要一个文件路径来实例化Configuration对象。有谁知道从文件以外的其他东西创建配置对象的方法吗?

最佳答案

只需使用System.IO将流保存到文件中并使用



ConfigurationManager.OpenMappedExeConfiguration(new ExeConfigurationFileMap(filename))


文献资料

http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.openmappedexeconfiguration(v=VS.90).aspx

关于.net - 从字符串加载配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5219385/

相关文章:

javascript - dotnet new Angular - dist 没有更新?

c - 避免在 C 中读取配置文件的全局变量

c# - 在 .net 中,哪种编程模型适合原型(prototype)制作,但随后可重复用于生产(用于业务逻辑/数据访问层)

c# - 从 .NET 中控制 Opera Driver

fortran - Fortran中的配置文件解析器

java - Commons-configuration 和 DefaultConfigurationBuilder 不会自动重新加载

php - 将php中的配置文件解析为变量

iphone - 最终配置文件发送到设备

c# - 所有值的变化都没有断点

c# - 使用通用 LINQ 表达式调用 Contains 方法的忽略大小写