title: Reading / writing new line character from/to xml
body: <p>I use xml file to store some key/value data:</p>
  
  <pre><code>&lt;Resource Key="A1" Value="Some text" /&gt;
  </code></pre>
  
  <p>What I am having problems with, is how would I save/load data in Value, if it is a multiline text?</p>
  
  <pre><code>&lt;Resource Key="A2" Value="Some text\nin two lines" /&gt;
  </code></pre>
  
  <p>which should, when displayed, result in</p>
  
  <pre><code>Some text
  in two lines
  </code></pre>
  
  <p>If I read above resource using </p>
  
  <pre><code>XDocument document = XDocument.Load(filePath);
  
  // get all the localized client resource strings
  var resource = (from r in document.Descendants("Resource")
                            where r.Attribute("Key").Value == "A2"
                            select r).SingleOrDefault();
  </code></pre>
  
  <p>it will read it with double backslash:</p>
  
  <pre><code>Some text\\nin two lines.
  </code></pre>
  
  <p>So, how can I read/save a new line character is some text, that for example, could later be displayed in WPF application or in web application?</p>
  
  <p><strong>Edit</strong>: here is an example (writes correctly, reads incorrectly):</p>
  
  <pre><code>&lt;!-- WPF window xaml code --&gt;
  &lt;Grid&gt;
    &lt;Button Name="btn" Content="Click me" /&gt;
  &lt;/Grid&gt;
  
  // WPF window code behind
  public MainWindow()
  {
      InitializeComponent();
  
      XDocument doc =
            new XDocument(
              new XElement("Resources",
                new XElement("Resource", new XAttribute("Key", "A1"), new XAttribute("Value", @"Some text\nin two lines")))
            );
  
      const string fileName = @"D:\test.xml";
      doc.Save(fileName);
  
      doc = XDocument.Load(fileName);
  
      IDictionary&lt;string, string&gt; keys = (from c in doc.Descendants("Resource")
                                          select c).ToDictionary(c =&gt; c.Attribute("Key").Value, c =&gt; c.Attribute("Value").Value);
  
      btn.ToolTip = keys["A1"];
      //btn.ToolTip = "Some text\nin two lines"; // if you uncomment this line, it works as expected
  }
  </code></pre>