Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我的配置文件(我提供自己的配置)是正确的,而无需针对 Xml Schema 进行验证,有什么方法可以检查 .net?
查看 System.Configuration 命名空间。有一个用于阅读配置设置的类,它可以为您轻松完成这项工作。
我相当肯定 AppSettingsReader 类会给你一些很好的验证技术。我通常只使用 Visual Studio 中应用程序设置提供的样板代码来执行此操作,如果文件无效,则系统将回退到默认值。