title: Replacing double backslash with one blackslash not working
body: <p>I am busy creating an <code>XDocument</code> object. In 1 of the elements I need to add the domain name and service account.  The service account comes in like:</p>
  
  <pre><code>MyDomainName\\MyServiceAccount
  </code></pre>
  
  <p>I need the tag to look like:</p>
  
  <pre><code>&lt;ChangeRunAsName&gt;MyDomainName\MyServiceAccount&lt;/ChangeRunAsName&gt;
  </code></pre>
  
  <p>It doesn't matter how I try to replace the <code>\\</code> with <code>\</code>, it still comes out as <code>\\</code>.</p>
  
  <p>Here is what I currently have:</p>
  
  <pre><code>XDocument xDocument = new XDocument(
       new XDeclaration("1.0", "utf-8", null),
       new XElement("MyAppsTable",
            myApplications.Select(component =&gt; new XElement("MyApps",
                 new XElement("ChangeResult", string.Empty),
                 new XElement("ChangeRunAsName", serviceAccount.DomainServiceAccount.Replace("\\\\", "\\")
            ))
       )
  );
  </code></pre>
  
  <p>The myApplications and serviceAccount input parameters look like this:</p>
  
  <pre><code>IEnumerable&lt;MyApplication&gt; myApplications
  ServiceAccount serviceAccount
  </code></pre>
  
  <p>I have tried the following:</p>
  
  <pre><code>serviceAccount.DomainServiceAccount.Replace("\\\\", "\\")
  serviceAccount.DomainServiceAccount.Replace(@"\\", @"\")
  </code></pre>
  
  <p>...and it still comes out as:</p>
  
  <pre><code>&lt;ChangeRunAsName&gt;MyDomainName\\MyServiceAccount&lt;/ChangeRunAsName&gt;
  </code></pre>
  
  <p>I'm not sure what to do anymore.</p>
  
  <p>I have this after the code above:</p>
  
  <pre><code>string xml = xDocument.ToString();
  </code></pre>
  
  <p>When debugging I look at the contents of xml and then I see <code>\</code> and <code>\\</code>.  This xml string I need to pass on to another method.</p>