fork download
  1. using System;
  2. using System.Linq;
  3. using System.Xml;
  4. using System.Xml.Linq;
  5.  
  6. public class Test
  7. {
  8. public static void Main()
  9. {
  10.  
  11. string dtNowTest = "2012-05-24T19:00:00:000";
  12. string url = "http://urslit.1x2.is/urslit/xml.exe/atburdir?dagsetning=" + dtNowTest;
  13.  
  14. var leikurs = (from e in XDocument.Load(url).Descendants("Mot")
  15. where (e.Attribute("Audkenni").Value == "ISL001")
  16. from m in e.Descendants("Leikur")
  17. select new Game()
  18. {
  19. Status = m.Attribute("StadaLeiks").Value,
  20. Hometeam = m.Element("Heimalid").Attribute("StuttHeiti").Value,
  21. Outteam = m.Element("Utilid").Attribute("StuttHeiti").Value,
  22. GoalsHometeams = Int32.Parse(m.Element("MorkHeimalids").Value),
  23. GoalsOutteams = Int32.Parse(m.Element("MorkUtilids").Value)
  24. }
  25. );
  26.  
  27. var result = leikurs
  28. .GroupBy(d => new { Heimalid = d.Hometeam, Utilid = d.Outteam })
  29. .Select(g => g.OrderBy(d => d.Status)
  30. .ThenByDescending(d => d.GoalsHometeams + d.GoalsOutteams)
  31. .First());
  32.  
  33.  
  34.  
  35.  
  36. }
  37. }
  38.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(4,18): error CS0234: The type or namespace name `Linq' does not exist in the namespace `System.Xml'. Are you missing an assembly reference?
Compilation failed: 1 error(s), 0 warnings
stdout

Standard output is empty