C#读写App.config文件,该如何解决

C#读写App.config文件
<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="ConStringEncrypt" value="false"/>
    <add key="ConnectionString" value=""/>
    <add key="AppName" value="OA"/>
  </appSettings>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="AuthorityServiceSoap" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
            <message clientCredentialType="UserName" algorithmSuite="Default"/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>

  </system.serviceModel>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>

App文件如上所示,我想把<add key="ConnectionString" value=""/>的value的值修改为constr字符串,请问怎么写啊
------解决方案--------------------
XDocument xDocument = XDocument.Load("App.Config");
xDocument.Root.Element("appSettings").Elements("add").ToList().Find(x => x.Attribute("key").Value == "ConnectionString").Attribute("value").Value = "connstr"; 
xDocument.Save("App.Config");

------解决方案--------------------
http://www.cnblogs.com/cpcpc/archive/2012/09/10/2679083.html