Im using c# .net , windows form application. I have a XML file which contains two columns and some rows of data. now i have to fill this data into a data grid view. I want to use LINQ.
You can try something like this:
// choose you filename there
XElement xElement = XElement.Load("file.xml");
// choose appropriate properties
dataGridView1.DataSource = (from el in xElement.Elements()
select new { a = el.Name.ToString(), b = "Whatever"}).ToList();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.