IEnumerable vs T[]

前端 未结 7 1260
天命终不由人
天命终不由人 2021-01-07 20:43

I just realize that maybe I was mistaken all the time in exposing T[] to my views, instead of IEnumerable.

Usually, for this kind

7条回答
  •  被撕碎了的回忆
    2021-01-07 21:08

    Given that changing the code from an array to IEnumerable at a later date is easy, but changing it the other way is not, I would go with a IEnumerable until you know you need the small spead benfit of return an array.

提交回复
热议问题