<?xml version="1.0" standalone="yes"?>
<Subject>
  <Book>
    <Name>ASP.NET</Name>
    <Author>ABC</Author>
    <Published>2018</Published>
    <Price>$100</Price>
  </Book>
</Subject>   
Above is the xml file i have. I want to store xml nodes and values using Dictionary or Collections in C# and display those on message box using winforms.
Output should be as:
Name: ASP.NET   
Author: ABC   
Published: 2018   
Price: $100     
I have tried the following but getting lots of errors...
var doc = XDocument.Load(@"xmlfile.xml");
var rootNodes = doc.Root.DescendantNodes().OfType<XElement>();
var keyValuePairs = from n in rootNodes
                    select new
                    {
                        TagName = n.Name,
                        TagValue = n.Value
                    };
var allitems = new Dictionary<string, string>();
foreach (var node in rootNodes)
{
    allitems.Add(node.Name.ToString(), node.Value);
    //string str = string.Join("",allitems);
    MessageBox.Show(allitems);
}
 
     
    