Sequence contains no elements exception in linq without even using Single

后端 未结 3 1905
轻奢々
轻奢々 2021-01-07 16:24

I am not using Single in LINQ below, but I am still getting a \'Sequence contains no elements\' exception:

allNames = StockCollection.Where((s)          


        
3条回答
  •  -上瘾入骨i
    2021-01-07 16:40

    Using Aggregate(func) on an empty source throws an InvalidOperationException.

    See documentation: http://msdn.microsoft.com/en-us/library/bb548651.aspx

提交回复
热议问题