0
Try this:
using System.Xml.Linq;
// ....
string xml = "<data> <name1>Ramesh</name1> <name2>Kumar</name2> </data>";
XElement data = XElement.Parse(xml);
var dict = new Dictionary<string, string>();
foreach (XElement child in data.Elements()) dict.Add(child.Name.ToString(), child.Value);
// check it worked
string temp = "";
foreach (string key in dict.Keys) temp += String.Format("{0} : {1}\r\n", key, dict[key]);
MessageBox.Show(temp);