If I have a method or a property that returns an IEnumerable<SomeType>
that leads to no data,
is it more efficient to return an empty array new SomeType[0]
or is it better to return an empty list new List<SomeType>()
or is there an even better solution (IMO building an own type with generics could be such a solution but it seems to me a little bit overkill)?
The array is my favorite but what do you think about this?
Return Enumerable.Empty<T>()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With