• DotNET 2.0 System.Configuration 配置类的不足


       这次是两年后再次使用2.0带的配置类编写配置文件,以前就觉得不是太灵活,但当时解决了问题就没有再深入研究了。现在再次使用,发现有很大限制。主要如下:

    1、默认情况下ConfigurationCollection类型下的Element只能是以add开头(除去remove、clear)。当然这个问题倒是可以解决:
        [ConfigurationCollection(typeof(TypeCollection), AddItemName = "Type")]

    2、ConfigurationCollection类型下不支持添加ConfigurationCollection类型的节点,只允许添加ConfiguarationElement类型的节点。

    3、ConfiguarationElement类型下不支持多个ConfigurationCollection类型节点,若写多个ConfigurationCollection类型节点,只有第一个节点可以读取到值。

    另外,ConfigurationCollection类型下支持多个ConfiguarationElement类型。

    补充:ConfigurationSection类型下同时支持多个ConfigurationCollection以及多个ConfiguarationElement类型。

    以上作为记录。

  • 相关阅读:
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    flutter webview_flutter 设置cookies
    flutter richText富文本
    flutter 安卓再次点击返回退出应用
  • 原文地址:https://www.cnblogs.com/Xrinehart/p/1011876.html
Copyright © 2020-2023  润新知