C
C#21h ago
Core

✅ IEnumerable vs IReadOnlyCollection

Hello, I have a scenario where I'm not sure which one should be used. The collection is only used internally, and only read operations are performed on it. Iteration on the collection happens once per method call. Which one is more appropriate in this case?
2 Replies
ero
ero21h ago
The concrete collection type returned, not an interface So List<T>, or T[], or whichever If it's all internal, then there's no reason for abstraction
Core
CoreOP21h ago
I see, thanks

Did you find this page helpful?