I have code similar to this:
class Foo
{
List<Bar> _myList;
...
public IEnumerable<Bar> GetList() { return _myList; }
}
The result of GetList () should NOT be mutable.
To clarify, this is normal if the Bar instances are modified.
I just want to make sure that the collection itself is not modified.
I am sure that I read the answer somewhere where someone indicated that it was possible, but for life I can no longer find me.
source
share