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, it is ok if instances of Bar are modified.
I simply want to make sure the collection itself is not modified.
I'm sure I read an answer somewhere on SO where someone pointed this was possible, but for the life of me, I can't find it again.