IEnumerable Isn't What You Think It Is-And It's Breaking Your Code | HackerNoon
Briefly

The article highlights the common mistake developers make by treating IEnumerable, both generic and non-generic, as collections. It explains that IEnumerable is an interface designed for generating items during iteration, which can lead to misunderstandings about costs and side effects, especially when complex implementations are involved. The author emphasizes that repeated enumeration can cause hard-to-reproduce bugs and performance issues, urging developers to understand the nature of IEnumerable to avoid making incorrect assumptions in their code.
IEnumerable is not a collection and treating it as such can cause hard-to-catch bugs due to repeated enumeration.
Many developers mistakenly view IEnumerable instances as collections, leading to assumptions about their behavior and performance.
The potential problems from repeated enumeration of IEnumerable include unexpected performance costs and side effects that can arise from complex implementations.
Developers need to understand the underlying mechanics of IEnumerable and implement code that avoids making assumptions about its behavior.
Read at Hackernoon
[
|
]