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

前端 未结 6 1130
广开言路
广开言路 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:22

    The error is complaining about your inner from clause (inside the where) it looks like you're trying to do a select many (unintentional clippy reference).

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

提交回复
热议问题