title: how to add self-closing tag to an element in xml?
body: <p>There are plenty of information for how to avoid self-closing tag for an XElement in C# on the web, but I want to do is the reverse one. I give a value to an XElement, and also want to see a self-closing tag in the output xml. </p>
  
  <p>This is my code:</p>
  
  <pre><code>XElement myElement = new XElement("MyItem",
      new Attribute("value1", "test1),
      new Attribute("value2", "test2),
      new Attribute("value3", "test3)
  );
  </code></pre>
  
  <p>This is what I got now in the output xml file:</p>
  
  <pre><code>&lt;MyItem value1="test1" value2="test2" value3="test3"&gt;
  
  &lt;/MyItem&gt;
  </code></pre>
  
  <p>What I want is: </p>
  
  <pre><code>&lt;MyItem value1="test1" value2="test2" value3="test3" /&gt;
  </code></pre>
  
  <p>How to do it? Thanks. </p>
  
  <p><strong>Additional information:</strong></p>
  
  <p>I am using C# with Visual Studio 2012. </p>