Difference between Select and ConvertAll in C#

前端 未结 4 1125
遇见更好的自我
遇见更好的自我 2020-12-01 04:50

I have some List:

List list = new List { 1, 2, 3, 4, 5 };

I want to apply some transformation to elements of my list.

4条回答
  •  一向
    一向 (楼主)
    2020-12-01 05:46

    I know this is bit late but i have still added because this could be of some use for others in future.

    When using it in EntityFramework query expression it is not recommended to use ConvertAll() as it evaluates the expression rather than leaving it as expression for future use. This seriously degrades database query execution performance as it would have to make number of calls before evaluating final expression.

提交回复
热议问题