Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. static void Main(string[] args)
  2.         {
  3.             XmlDocument doc = new XmlDocument();
  4.             doc.Load("../../../Albums.xml");
  5.             var albums = doc.SelectNodes("/albums/album");
  6.             foreach (XmlElement album in albums)
  7.             {
  8.                 var now = DateTime.Now.Year;
  9.                 var albumDate = int.Parse(album["year"].InnerText);
  10.                 int diffrence = now - albumDate;
  11.                 if (diffrence >= 5)
  12.                 {
  13.                     var title =album["name"].InnerText;
  14.                     var price = album["price"].InnerText;
  15.                     Console.WriteLine("Album : {0} - Price: {1}",title,price);
  16.                 }
  17.             }
  18.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement