Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Xml.Linq;
- namespace LinqToXml
- {
- class Program
- {
- static void Main(string[] args)
- {
- //Data source
- XElement xmlFile = XElement.Load(@"E:\MAS OKIE DOCS\MEDIATUTORIAL\41.1 Mengenal LINQ (Language Integrated Query)\LinqToXml\LinqToXml\DataSource.xml");
- //Create Query
- IEnumerable<XElement> dataSiswa = from abc in xmlFile.Elements("student").Elements("name")
- select abc;
- //Execute Query
- foreach (string data in dataSiswa)
- {
- Console.WriteLine(data);
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement