In a response to this question runefs suggested that "unless you have a very specific reason for using IList you should considere IEnumerable". Which do you use and why?
IEnumberable<T>
is read-only, you have to reconstruct the collection to make changes to it. On the other hand, IList<T>
is read-write. So if you expect a lot of changes to the collection, expose IList<T>
but if it's safe to assume that you won't modify it, go with IEnumerable<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