reactiveui/ReactiveUI — pull request #432 by jlaanstra (2013-12-11 16:20:58+00:00)
Title: Improve interfaces for reactive collections.

This PR is meant to do some more clean-up based on #430 and continue the discussion. It is also related to #266 and #336.

## Context

During development of ReactiveUI 5.0 the collection interfaces were changed in #336. This lead to some ambiguity problems on `IReactiveList` because it inherited from two interfaces that defined the `Count` property as reported in #427. This was fixed in #430, by removing `IList` from `IReactiveList` and `ICollection` from `IReactiveCollection`.

## Remaining problems
After the change in #430, `IReactiveCollection` still implements `ICollection` and is now no longer just a generic variant of `IReactiveCollection`, like it was before. In fact the need for the non-generic `IReactiveCollection` interface is questionable.

## Proposal

As @Haacked explained, the `IReactiveCollection` interfaces serves as the base interface for reactive "collections".
The PR proposes to transfer this role to the generic interface `IReactiveCollection` and remove the non-generic interface. This will make the interfaces more inline with the readonly interfaces from the BCL and generics are really the way to go.

Concrete changes:

- `IReactiveCollection` no longer inherits from `ICollection` like `IReadOnlyCollection`.
- `IReactiveCollection` can be made covariant because of the above change.
- ReactiveUI only introduces new generic collection interfaces which people should use anyway.
- `IReadOnlyReactiveCollection` now simply inherits from `IReactiveCollection` and `IReadOnlyCollection` which I think makes sense.

## What does this break?

- **Anything dependending on the non-generic `IReactiveCollection`**. I believe you can just use the generic variant almost everywhere, since every collection type in ReactiveUI is generic.
- **Anything implementing `IReactiveCollection` only loses the type `IReactiveCollection`**. All its interfaces are still implemented by the generic variant.
- **The `IReactiveCollection` interface no longer implements `ICollection`**. However it does still implement `IEnumerable`.

This does not break:

- `IReadOnlyReactiveCollection` does NOT break. Although its inheritance hierarchy changes it still implements the same interfaces as before.
- `IReactiveList`still implements `ICollection`, because it implements `IList`. It only loses the `IReactiveCollection` type in its inheritance hierarchy.

I think I got everything covered. Because of the things that this PR breaks, it probably won't go in before 5.5 or 6 if it goes in at all, but I think it is a good improvement.

Thoughts?