XElement root = XElement.Load("nations.xml");
IEnumerable<XElment> tests =
from el in root.Elements("nations')
select el;
List<Nation> markets = new List<Nation>();
foreach(XElement el in tests)
{
markets.Add(new Nation((double)el.Element("rich"), (double)el.Element("mclass"), (double)el.Element("poor")));
}
๋๊ฐ ์ ๋ฐ ์์ผ๋ก ๋ฆฌ์คํธ์ ๋ฃ๊ณ ์๋๋ฐ ๋ ํธํ ๋ฐฉ๋ฒ๋ ์์?
์๋๋ฉด ๋ง๋ ๋ฐฉ๋ฒ? "๋ณ์ ์ ๊ทธ๊ฑฐ ๊ทธ๋ ๊ฒ ์ฐ๋๊ฑฐ ์๋์ผ .."
List<Nation> markets = root.Elements("nations").Select(el => new Nation((double)el.Element("rich"), (double)el.Element("mclass"), (double)el.Element("poor"))).ToList();
์ค ์ฌ์ฝ์ ใฑใ ใฑใ