here is my xml:
<record>
<id>12342</id>
<name>xx</name>
<blah1>asdfas</blah1>
<blah2>asdfas</blah2>
.....
</record>
I would like to get all of the values and put it into a array. i tried the following, it returns "12342xxasdfasasdfas" instead of "12342","xx","asdfas","asdfas"
var q = record.Elements("record").Select(r=>r.Value);
string[] array = q.ToArray();
i have come up the solution by using foreach loop, just wondering if there are any better ways to do that?
var q2 = record.Descendants("record").Elements();
int length = Convert.ToInt32(q2.Count().ToString());
string[] array2 =new string[length];
int i = 0;
foreach (XElement e in q2)
{
array2[i] = e.Value;
i++;
}