2016-12-16 62 views
0

我有一个配置文件,其中添加了自定义部分。如何访问ConnectionString字段并进行更新? (我不能使用XPath或任何XML相关的东西)访问和更新配置文件中的自定义部分

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <configSections> 
     <section name="HandleApplication" 
       type="Contracts.ConfigSections.HandleApplication, Contracts"/> 
    </configSections> 
    <HandleApplication> 
     <Handler AppId="2" ConnectionString="XXXXXXXXXXXXX"/>  
    </HandleApplication> 
</configuration> 

回答

0

为什么你不能使用任何XML相关的东西? 你可能想考虑REGEX

+0

为什么你会使用正则表达式来读取定义良好的配置文件? – mason

+0

@Haim我只能使用ConfigurationManager的方法,请不要问为什么:) – user1890098

+0

@ user1890098为什么? – mason

相关问题