I\'d like to expose a property on a view model that contains a list of objects (from database).
I need this collection to be read-only. That is, I want to prevent A
Use ReadOnlyObservableCollection< T >
public ReadOnlyObservableCollection ReadOnlyFoo { get { return new ReadOnlyObservableCollection (_CollectionOfFoo); } }
As has been pointed out, please use Eric J's answer as this one mistakenly is returning a new instance every time.