This project has moved. For the latest updates, please go here.

Monitoring collections

Mar 9, 2012 at 3:10 PM

Hi Nathan,

Great work on MUF! Have you been thinking about monitoring properties which are of tyme e.g. List<SomeObject> ?

Maybe I missed something but I think the only method right now is to store and restore the whole collection which could be quite memory-consuming sometimes.



Mar 9, 2012 at 3:50 PM

Thanks @Tuvok.

Monitoring a List<SomeObject> does present some challenges. The current implementation hooks the events that are raised by the ObservableCollection to do the per item add/remove monitoring. However, List<> does not have this event, which makes it tough to detect when changes happen.

There may be alternative ways to intercept these changes, but it depends on your application's design. In a worst case scenario (e.g. you must use a List<>), then you would probably want to try and intercept the logic that is modifying the list. This is somewhat painful to implement, and may not be possible if you don't own all the code paths that modify the list.

A slightly better scenario might be that you could use your own implementation of IList<> so that you can capture the adds / removes.This might work, but depends on whether the app is coded against IList<> or List<>.

I'm guessing that you've already considered these possibilities. I'm open to other ideas, and happy to integrate them into the project. What are your thoughts on possible solutions to your scenario?


Mar 12, 2012 at 11:02 AM

Frankly, ObservableCollection is enouch for me :)

I missed that the framework supports changes on that; maybe, because sample application hasn't got any code using this feature. I also checked in documentation and there's also nothing about that. I think the framework is really great but you should put more attention to the documentation. Something like msdn or javadocs would be great ant that's the only thing which I think is missing :)