DataSet ds = new DataSet(); ds.ReadXml(dataFile); Console.WriteLine(data.Length); string dataxml = ds.GetXml(); DataSet ds1 = new DataSet(); using (System.IO.StringReader xmlSR = new System.IO.StringReader(dataxml)) { ds1.ReadXml(xmlSR); }