Skip to content

Instantly share code, notes, and snippets.

@VladVin
Created November 24, 2015 19:08
Show Gist options
  • Save VladVin/26762cd7b10da926f82e to your computer and use it in GitHub Desktop.
Save VladVin/26762cd7b10da926f82e to your computer and use it in GitHub Desktop.
DataTable dt;
DataSet readDs;
public MainWindow()
{
InitializeComponent();
dt = new DataTable();
DataColumn dc;
dc = new DataColumn();
dc.ColumnName = "Name";
dt.Columns.Add(dc);
dc = new DataColumn();
dc.ColumnName = "Number";
dt.Columns.Add(dc);
for (int i = 0; i < 5; i++)
{
DataRow dr = dt.NewRow();
dr["Name"] = "Row " + i;
dr["Number"] = i;
dt.Rows.Add(dr);
}
DataSet ds = new DataSet();
ds.Tables.Add(dt);
ds.WriteXml("out.xml");
readDs = new DataSet();
readDs.ReadXml("out.xml");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment