Cannot implicitly convert type 'System.Linq.IQueryable' to 'int?'

前端 未结 6 1858
梦毁少年i
梦毁少年i 2021-02-06 23:14
var cityList = from country in 
                    doc.Element(\"result\")
                    .Element(\"cities\")
                    .Descendants(\"city\")
select ne         


        
6条回答
  •  甜味超标
    2021-02-06 23:34

    As the error message says, your Linq query returns an System.Linq.IQueryable (for all intents and purposes a collection of ints). If you'd like to get one of them, you can either call First or ElementAt(n) to get the n'th element.

提交回复
热议问题