Safiron

Untitled

Dec 16th, 2013
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. public List<League> getLeagues()
  2.         {
  3.             List<League> temp = new List<League>();
  4.             List<string> tempIds = new List<string>();
  5.             List<string> tempNames = new List<string>();
  6.             XDocument doc = XDocument.Load("C:\\Users\\Saphiron\\documents\\visual studio 2012\\Projects\\Pineczive\\Pineczive\\App_Data\\Leagues.xml");
  7.             var ids = doc.Descendants("id");
  8.             var names = doc.Descendants("name");
  9.  
  10.             foreach (var i in ids)
  11.             {
  12.                 tempIds.Add(i.Value.ToString());
  13.             }
  14.  
  15.             foreach (var n in names)
  16.             {
  17.                 tempNames.Add(n.Value.ToString());
  18.             }
  19.  
  20.             for (int i = 0; i < tempIds.Count(); i++)
  21.             {
  22.                 temp.Add(new League(tempIds[i], tempNames[i], false, "cze",string.Empty, string.Empty));
  23.             }
  24.  
  25.             return temp;
  26.         }
Advertisement
Add Comment
Please, Sign In to add comment