How does the following LINQ statement work?

后端 未结 5 1194
南旧
南旧 2021-01-29 22:24

How does the following LINQ statement work?

Here is my code:

var list = new List{1,2,4,5,6};
var even = list.Where(m => m%2 == 0);
list.Add         


        
5条回答
  •  终归单人心
    2021-01-29 23:06

    This has happened because of deferred execution, which means that the calculation of the expression is not executed until it is needed someplace. This makes the performance better if the data is too large.

提交回复
热议问题