First, I would merge the XMLs. So, assuming, that the all XMLs share a common root element, you could use the next method to merge them:
private XmlDocument mergeXML(XmlDocument xmlDoc1, XmlDocument xmlDoc2)
{
foreach (XmlNode node in xmlDoc2.DocumentElement.ChildNodes)
{
XmlNode imported = xmlDoc1.ImportNode(node, true);
xmlDoc1.DocumentElement.AppendChild(imported);
}
return xmlDoc1;
}
Then, you can use the OutterXML property to get the string content of the resultant XML, like this:
XmlDocument xmlDoc1 = new XmlDocument();
XmlDocument xmlDoc2 = new XmlDocument();
xmlDoc1.LoadXml("<?xml version='1.0'?><field><subfield1>hi</subfield1></field>");
xmlDoc2.LoadXml("<?xml version='1.0'?><field><subfield2>hello</subfield2></field>");
XmlDocument mergedXML = mergeXML(xmlDoc1, xmlDoc2);
Dictionary<string, string> XMLDictionary = new Dictionary<string, string> {
{mergedXML.OuterXml, "whatever" }
};
Of course, the resultant string is parseable again to XMLDocument, you could check it using linQ to access the key:
XmlDocument resultXML = new XmlDocument();
resultXML.LoadXml(XMLDictionary.Keys.ElementAt(0));