I assign a value to two class fields as follows.
static Dictionary<string, string> XmlToDict(string loadFile) { Dictionary<string, string> dic = new Dictionary<string, string>(); XmlDocument document = new XmlDocument(); document.Load(loadFile); foreach (XmlNode node in document.DocumentElement.ChildNodes) { string value = node.Attributes["value"].Value; string key = node.Name; if (!string.IsNullOrEmpty(value)) { dic.Add(key, value); } } return dic; } static void Main(string[] args) { string rusXml = "D:\\My Documents\\Visual Studio 2010\\Projects\\obyedinenieDannix\\obyedinenieDannix\\rusXml.xml"; string engXml = "D:\\My Documents\\Visual Studio 2010\\Projects\\obyedinenieDannix\\obyedinenieDannix\\engXml.xml"; Dictionary<string, string> dic1 = XmlToDict(rusXml); Dictionary<string, string> dic2 = XmlToDict(engXml); var vivod = dic1.Select( kvp => new ClassVivod() { _key = kvp.Key, _valueXML_1 = kvp.Value }) .ToArray(); class itself:
public class ClassVivod { public string _key; public string _valueXML_1; public string _valueXML_2; public string Key { get { return _key; } set { _key = value; } } public string ValueXML_1 { get { return _valueXML_1; } set { _valueXML_1 = value; } } public string ValueXML_2 { get { return _valueXML_2; } set { _valueXML_2 = value; } } } ClassVivod has another field valueXML_2. There you need to write the value from dic2, provided that key = dic2.Key .. if it is not difficult, key = dic2.Key me how.