Created
November 24, 2015 19:08
-
-
Save VladVin/26762cd7b10da926f82e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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