Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 如何在其自己的文件中使用自定义配置节?_.net_.net 4.5 - Fatal编程技术网

.net 如何在其自己的文件中使用自定义配置节?

.net 如何在其自己的文件中使用自定义配置节?,.net,.net-4.5,.net,.net 4.5,过去,我在app.config文件中创建了自定义配置节。如何将ConfigurationSection移动到它自己的文件中,独立于我的应用程序的主配置文件?在app.config文件中执行此操作 <configuration> <configSections> <section name="customSection" type="ABC" /> </configSections> <customSection c

过去,我在app.config文件中创建了自定义配置节。如何将ConfigurationSection移动到它自己的文件中,独立于我的应用程序的主配置文件?

在app.config文件中执行此操作

<configuration>
   <configSections>
        <section name="customSection" type="ABC" />
   </configSections>
<customSection configSource="custom.config"></customSection> //Your own file name is the configSource

//您自己的文件名是configSource
创建另一个名为custom.config的文件。在该文件中:

   <customSection>
   //Your config here
   </customSection>

//你的配置在这里