Intermediate
C#
Q99 / 100
What is the difference between IEnumerable and IReadOnlyCollection in C#?
Correct! Well done.
Incorrect.
The correct answer is B) IEnumerable is forward-only lazy; IReadOnlyCollection adds Count and Contains, implying the collection is fully materialized
B
Correct Answer
IEnumerable is forward-only lazy; IReadOnlyCollection adds Count and Contains, implying the collection is fully materialized
Explanation
Prefer IReadOnlyCollection<T> in APIs when callers need Count without materializing. Use IEnumerable<T> only when lazy evaluation is intentional.
Progress
99/100