title: How to create XML string instead of using string builder?
body: <p>I am using the code below (simplified for this example) to post data to a SharePoint list</p>
  
  <pre><code>StringBuilder customerDoc = new StringBuilder();
  
  customerDoc.Append("&lt;Method ID='1' Cmd='New'&gt;");
  customerDoc.Append("&lt;Field Name='Name'&gt;" + Name + "&lt;/Field&gt;");
  customerDoc.Append("&lt;Field Name='Age'&gt;" + age + "&lt;/Field&gt;");
  customerDoc.Append("&lt;Field Name='City'&gt;" + city + "&lt;/Field&gt;");
  customerDoc.Append("&lt;Field Name='Country'&gt;" + country + "&lt;/Field&gt;");
  
  customerDoc.Append("&lt;/Method&gt;");
  
  XmlDocument xDoc = new XmlDocument();
  XmlElement xBatch = xDoc.CreateElement("Batch");
  xBatch.SetAttribute("OnError", "Continue");
  
  xBatch.InnerXml = sb_method.ToString();
  
  XmlNode xn_return = sharePoint.listsObj.UpdateListItems(ConfigurationManager.AppSettings["SaveCustomer"].ToString(), xBatch);
  </code></pre>
  
  <p>As you can see I am using a stringbuilder which isn't ideal so I wonder what I should use instead to create an XML string?</p>
  
  <p>Thanks in advance.</p>