문제

App.Config에서 아래의 나무와 같이 트리를 저장하는 가장 좋은 방법은 무엇 이며이 정보를 어떻게 저조 하는가?

Tree
|-node1-
|       |-name - value
|       |-name - value
|       | ......
|-node2-
|       |-name - value
|       |-name - value
|       | ......
|-node3-
|       |-name - value
|       |-name - value
|       | ......

도움이되면 그 트리를 XML로 변환 할 수 있습니다.

미리 도움을 주셔서 감사합니다.

도움이 되었습니까?

해결책

Use a custom configuration section. For one way to do this, see Configuration Section Designer. You can do it manually, but you might like to play with CSD and see the code it generates.

다른 팁

You can extend .config with your own types. These can be elements containing other elements and attributes. This area does seem to be poorly documented but there are examples out there.

Start with the System.Configuration.ConfigurationElement class.

You can use and xml based document inside your app with .config extension( like NLog.config , ... ) and use a custom data provider to read the xml data and convert they to tree-like ds.

<Nodes>
    <Node Name="Node1" Value="Value1">
       <Node Name="Node1.1" Value="Value1.2">
       </Node>

       <Node Name="Node1.2" Value="Value1.2">
       </Node>
    </Node>

    <Node Name="Node2" Value="Value2">
    </Node>
</Nodes>

or you can use a custom config section

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top