Interesting discussion over in WinFX land today, thought you might want to chime in:
What is better from the standpoint of the design guidelines:1) Single class FooCollection with an IsReadOnly property and an AsReadOnly method returning a FooCollectionor 2) Two classes: FooCollection and ReadOnlyFooCollection
One suggestions, which I think is a pretty good one:
It depends. I would do #2 in commonly used API as it’s cleaner in terms of the Object Model. I would do #1 in to save one type is less commonly used API.
Of course with generics this gets a little easier...
What do you think?