[C#] xml Parsing GetElementsByTagName

XmlDocument doc = new XmlDocument();
doc.Load(“Book.xml”);

XmlNodeList node = doc.GetElementsByTagName(“Books”);

for (int i = 0; i < node.Count; i++) //방법1
{
Console.WriteLine(node.Item(i).SelectSingleNode(“Name”).InnerText);

}

foreach (XmlNode node in node)//방법2
{
Console.WriteLine(node.SelectSingleNode(“Name”).InnerText);
}