Why does the IEnumerable.Select() works in 1 of 2 cases ? Can not be inferred from usage

后端 未结 5 784
无人及你
无人及你 2021-01-18 03:26

I get this error message:

The type arguments for method \'System.Linq.Enumerable.Select(System.Collections.Generic.IE         


        
5条回答
  •  攒了一身酷
    2021-01-18 03:40

    The Error seems The Return statement missing when you select an Items from the collection.

    Example:

    collection = nonLabors.Select(item =>
                    {
                        item.Travel_Miles = item.Travel_Miles_Original != null ? decimal.Parse(item.Travel_Miles_Original) : 0;
                        return item;
                    }).ToList();
    

提交回复
热议问题