c# - How to get the values of all the elements in an XML into an array? -


for example :

i have following xml,

<?xml version="1.0" encoding="utf-8"?> <test> <name>testrun</name> <syncbyte>ff</syncbyte> <som>53</som> <pdadd>7e</pdadd> <lenlsb>08</lenlsb> </test> 

i values tags "syncbyte", "som", "padd" , "lenlsb" single array. there option within xml accomplish this?

p.s. there close 20+ tags in xml , not tags contain values time. hence if there single command values of xml, great.

with linq xml:

    var xml = @"<?xml version=""1.0"" encoding=""utf-8""?>     <test>         <name>testrun</name>         <syncbyte>ff</syncbyte>         <som>53</som>         <pdadd>7e</pdadd>         <lenlsb>08</lenlsb>     </test>";      var doc = xdocument.parse(xml);     string[] values = doc.root.descendants().select(x => x.value).toarray(); 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -