I'm having trouble grabbing elements in an unknown way. I do not want to call elements by name. The second sealed statement only catches the whole section as it is an element. How can I cycle through all the values without calling each and every name? I am open to the linq statement, but from every example I have read, I do not know how I can use the phone without using each element using the name. Thanks for any help!
public square box {public list & lt; Person & gt; People {receive; Set; }} Public Sector Person {Public Dictionary & lt; String, string & gt; Data {Received; Set; }} / * & Lt; External & gt; & Lt; Xml & gt; & Lt; Person & gt; & Lt; Data & gt; & Lt; Home & gt; Big & lt; / Home & gt; & Lt; Cell & gt; 911 & lt; / Cell & gt; & Lt; Address & gt; NA & lt; / Address & gt; & Lt; / Data & gt; & Lt; / Person & gt; & Lt; Person & gt; & Lt; Data & gt; & Lt; Home & gt; Big & lt; / Home & gt; & Lt; Cell & gt; 911 & lt; / Cell & gt; & Lt; Address & gt; NA & lt; / Address & gt; & Lt; / Data & gt; & Lt; / Person & gt; & Lt; Person & gt; & Lt; Data & gt; & Lt; Home & gt; Big & lt; / Home & gt; & Lt; Cell & gt; 911 & lt; / Cell & gt; & Lt; Address & gt; NA & lt; / Address & gt; & Lt; / Data & gt; & Lt; / Person & gt; & Lt; Person & gt; & Lt; Data & gt; & Lt; Home & gt; Big & lt; / Home & gt; & Lt; Cell & gt; 911 & lt; / Cell & gt; & Lt; Address & gt; NA & lt; / Address & gt; & Lt; / Data & gt; & Lt; / Person & gt; & Lt; / XML & gt; & Lt; / External & gt; * / This.box.People = New list & lt; Person & gt; (); Foreign language (different elements in XML ("person")) {any person = new person {data = new dictionary & lt; String, string & gt; (),}; Forward (("data") in ele.Descendants (somebody.data.Add (temp.Name.ToString (), temp.Value.ToString ())}} This.box.People.Add (any);} < / Code>
This works ( tested ) - right now Was missing element () part: foreach (ele.Descendants ("data") var temp. Element ()) {somebody.data.Add (temp) Name. Toaster (), temp.Value);}
Comments
Post a Comment