Can someone guide me on to repairing the error on this query :
var objApps = from item in xDoc.Descendants(\"VHost\")
where
I like the procedural way of linq which can be more linear in its approach; I believe you want
var result = xDoc.Descendants("VHost")
.Descendants("ConnectionsTotal")
.Select(ele => ele.Value )
.Select( value => new clsApplication
{
ConnectionsTotal = value
})
;
--- Test in LinqPad ---
string xml = @"
67
1424182
1385091
39091
410455.0
540146.0
_defaultVHost_
5129615.178
0
67
1424182
1385091
39091
410455.0
540146.0
TestApp
loaded
411642.953
11
43777
43135
642
27876.0
175053.0
";
var XDoc = XDocument.Parse(xml);
XDoc.Descendants("VHost")
.Descendants("ConnectionsTotal")
.Select (ele => ele.Value )
.Dump();