IEnumerable vs List - What to Use? How do they work?

后端 未结 10 2103
臣服心动
臣服心动 2020-11-22 03:57

I have some doubts over how Enumerators work, and LINQ. Consider these two simple selects:

List sel = (from animal in Animals 
                         


        
10条回答
  •  囚心锁ツ
    2020-11-22 04:15

    Nobody mentioned one crucial difference, ironically answered on a question closed as a duplicated of this.

    IEnumerable is read-only and List is not.

    See Practical difference between List and IEnumerable

提交回复
热议问题