<?xml version="1.0"?><phonebooklist> <pbdata> <name>Tanmay</name> <contact>1324569780</contact> </pbdata> <pbdata> <name>Ranjan</name> <contact>8956231447</contact> </pbdata> <pbdata> <name>Tamojit</name> <contact>342352</contact> </pbdata> <pbdata> <name>deba</name> <contact>666666</contact> </pbdata></phonebooklist>
XmlReader xr = XmlReader.Create("test.xml"); while (xr.Read()) { if (xr.NodeType == XmlNodeType.Element && xr.Name == "name") listBox1.Items.Add(xr.ReadElementString()); else xr.Read(); }