Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- XmlDocument doc = new XmlDocument();
- doc.Load("../../../Albums.xml");
- var albums = doc.SelectNodes("/albums/album");
- foreach (XmlElement album in albums)
- {
- var now = DateTime.Now.Year;
- var albumDate = int.Parse(album["year"].InnerText);
- int diffrence = now - albumDate;
- if (diffrence >= 5)
- {
- var title =album["name"].InnerText;
- var price = album["price"].InnerText;
- Console.WriteLine("Album : {0} - Price: {1}",title,price);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement