Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private DataTable TablePoint()
- {
- //создаём таблицу
- DataTable dtPoint = new DataTable();
- //создаём три колонки
- DataColumn x = new DataColumn("x", typeof(Double));
- DataColumn y = new DataColumn("y", typeof(Double));
- //добавляем колонки в таблицу
- dtPoint.Columns.Add(x);
- dtPoint.Columns.Add(y);
- return dtPoint;
- }
- listDt.Add(TablePoint());
- DataRow newRowListDt = null;
- foreach (XElement elm in xDoc.Descendants("point"))
- {
- newRowListDt = listDt[0].NewRow();
- if (elm.Element("x") != null)
- {
- newRowListDt["x"] = double.Parse(elm.Element("x").Value);
- }
- if (elm.Element("y") != null)
- {
- newRowListDt["y"] = double.Parse(elm.Element("y").Value);
- }
- listDt[0].Rows.Add(newRowListDt);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement