01 | using System; |
02 | using System.Collections.Generic; |
03 | using System.Linq; |
04 | using System.Xml.Linq; |
05 | using System.Text; |
06 |
07 | namespace Demo |
08 | { |
09 | class Program |
10 | { |
11 | static void Main(string[] args) |
12 | { |
13 | string xmlFileName = @"C:\CustomerOrders.xml"; |
14 | XDocument cust = XDocument.Load(xmlFileName); |
15 | |
16 | Console.WriteLine("Elements in XML:"); |
17 | var qResult = from c in cust.Elements() |
18 | select c.Name; |
19 | foreach (var itemList in qResult) |
20 | { |
21 | Console.WriteLine(itemList); |
22 | } |
23 | Console.Write("Press Enter to continue:"); |
24 | Console.ReadLine(); |
25 |
26 | } |
27 | } |
28 | } |


Join the conversation! Your thoughts help the community grow.