title: C# String.Replace double quotes and Literals
body: <p>I'm fairly new to c# so that's why I'm asking this here.</p>
  
  <p>I am consuming a web service that returns a long string of XML values. Because this is a string all the attributes have escaped double quotes</p>
  
  <pre><code>string xmlSample = "&lt;root&gt;&lt;item att1=\"value\" att2=\"value2\" /&gt;&lt;/root&gt;"
  </code></pre>
  
  <p>Here is my problem. I want to do a simple string.replace. If I was working in PHP I'd just run strip_slashes().</p>
  
  <p>However, I'm in C# and I can't for the life of me figure it out. I can't write out my expression to replace the double quotes (") because it terminates the string. If I escape it then it has incorrect results. What am I doing wrong?</p>
  
  <pre><code>    string search = "\\\"";
      string replace = "\"";
      Regex rgx = new Regex(search);
      string strip = rgx.Replace(xmlSample, replace);
  
      //Actual Result  &lt;root&gt;&lt;item att1=value att2=value2 /&gt;&lt;/root&gt;
      //Desired Result &lt;root&gt;&lt;item att1="value" att2="value2" /&gt;&lt;/root&gt;
  </code></pre>
  
  <blockquote>
    <p>MizardX: To include a quote in a raw string you need to double it.   </p>
  </blockquote>
  
  <p>That's important information, trying that approach now...No luck there either
  There is something going on here with the double quotes. The concepts you all are suggesting are solid, BUT the issue here is dealing with the double quotes and it looks like I'll need to do some additional research to solve this problem. If anyone comes up with something please post an answer.</p>
  
  <pre><code>string newC = xmlSample.Replace("\\\"", "\"");
  //Result &lt;root&gt;&lt;item att=\"value\" att2=\"value2\" /&gt;&lt;/root&gt; 
  
  string newC = xmlSample.Replace("\"", "'");
  //Result newC   "&lt;root&gt;&lt;item att='value' att2='value2' /&gt;&lt;/root&gt;"
  </code></pre>