Expose a Read-Only Collection in C# with AsReadOnly
Let callers read a private list without changing it, using AsReadOnly and IReadOnlyList, and why returning IEnumerable alone does not protect it.
Let callers read a private list without changing it, using AsReadOnly and IReadOnlyList, and why returning IEnumerable alone does not protect it.