[C#] DataTable als XML Textdatei speichern

private void SaveDataTable(DataTable dt, string filename)
{
    DataSet ds = new DataSet("TestDataSet");
    ds.ExtendedProperties["TimeStamp"] = DateTime.Now;
    ds.ExtendedProperties["Company"] = "TestCompany";

    ds.Tables.Add(dt);
    string xml = ds.GetXml();

    StreamWriter sw = new StreamWriter(filename, false, Encoding.UTF8);
    sw.Write(xml);
    sw.Close();
}