我有像这样的app.config xml
<ProcessConfiguration>
<Entry>
<Type>type1</Type>
<folder>folder1</folder>
<fileName>filename1</fileName>
<Command arguments="arg1">command1</Command>
<history>history1</history>
</Entry>
<Entry>
<Type>type2</Type>
<folder>folder2</folder>
<fileName>filename2</fileName>
<Command arguments="arg2">command2</Command>
<history>history2</history>
</Entry>
</ProcessConfiguration>
我已经在配置部分添加了这个
<configSections>
<section name="ProcessConfiguration" type="Assembly.namespace, Assemblyname"
requirePermission="false" allowDefinition="Everywhere"/>
</configSections>
但我无法实现configsection,因为我不知道如何在这里处理ConfigurationElementCollection和ConfigurationElement。任何人都可以帮我解决这个问题吗?
答案 0 :(得分:0)
对于app.config中的每个条目,您必须使用添加标记。
这样的事情:
<ProcessConfiguration>
<ConfigurationElementCollectionName> <!-- In your custom config section class -->
<add>
<Type>type1</Type>
<folder>folder1</folder>
<fileName>filename1</fileName>
<Command arguments="arg1">command1</Command>
<history>history1</history>
</add>
</ConfigurationElementCollectionName>
</ProcessConfiguration>