LINQ to XML : A query body must end with a select clause or a group clause

前端 未结 6 1131
广开言路
广开言路 2021-01-20 01:31

Can someone guide me on to repairing the error on this query :

       var objApps = from item in xDoc.Descendants(\"VHost\") 
                          where         


        
6条回答
  •  爱一瞬间的悲伤
    2021-01-20 02:32

    Simply do the following, no need for the where clause. Descendants will search children at ALL levels, not just immediately below:

    var objApps = from item in xDoc.Descendants("Application") 
                       select new clsApplication
                       {
                           ConnectionsTotal = item.Element("ConnectionsTotal").Value
                       };
    

提交回复
热议问题