reactiveui/ReactiveUI — pull request #336 by niik (2013-07-01 15:14:59+00:00)
Title: Read-only interfaces for derived collections

I have some plans™ about derived collections in rxui5 but there's probably a very slim chance of me getting the time to do it before 5.0 ships (#219). One of the things I'd really like to do is to make derived collections not inherit ReactiveCollection. Doing so would be a breaking change and I'd really like to avoid being stuck with that inheritance until the next major version. Thus:

#### Cue @Haacked and good ideas

@Haacked suggested in #267 that we should add read-only interfaces to the derived collections to make it super obvious that they are just that, read-only. I think that's an excellent idea and now that we're only targeting .net 4.5 we can make use of the new read only interfaces contained therein without having to worry about backwards compatibility.

Not only is this a good idea, it also solves my problem since we can have the CreateDerivedCollection return the interface leaving me free to do as I please with regards to inheritance going forward.

@Haacked added read-only interfaces in #290 but unfortunately that got reverted in 4ded0d254f81a2c1683913f842b3b46a3097f26f due to some nasty build errors so I went ahead and took a swing at it myself. I've introduced three new noteworthy interfaces: ```IReadOnlyReactiveCollection```, ```IReadOnlyReactiveList``` and ```IReactiveDerivedList```. In addition to those I've had to refactor the previous interfaces so that both the read-only and the writable interfaces can share as much as possible. I've tried to mirror the read-only inheritance from ```IReadOnly(Collection|List)``` in the BCL.

#### Overview

![rxui-interfaces](https://f.cloud.github.com/assets/634063/730882/5bdd42b8-e25f-11e2-8093-5e5317e93f1d.png)
(green indicates a new interface)

#### Notes

* ```IReactiveCollection``` exists as both a generic and a non-generic interface, I assume in part to match ```ICollection```/```ICollection```. ```IReadOnlyList``` and ```IReadOnlyCollection``` in the BCL only exist in generic versions so I chose to follow that here as well.
* ```IReactiveNotifyCollectionItemChanged``` is a mouthfull. I'm open to changing it if anyone has a better idea. It's supposed to match ```IReactiveNotifyCollectionChanged```