Hacker News new | past | comments | ask | show | jobs | submit login

One of my recent favorite libraries lately is DynamicData [1] which is Rx for collections. It allows you to use LINQ operators to create lots of different collections from a single "observable cache". An example from the github page:

    var list = new ObservableCollectionExtended<TradeProxy>();
    var myoperation = somedynamicdatasource
                        .Filter(trade=>trade.Status == TradeStatus.Live) 
                        .Transform(trade => new TradeProxy(trade))
                        .Sort(SortExpressionComparer<TradeProxy>.Descending(t => t.Timestamp))
                        .ObserveOnDispatcher()
                        .Bind(list) 
                        .DisposeMany()
                        .Subscribe()
This takes the collection at somedynamicdatasource, transforms the contents to TradeProxy objects, sorts it, and binds it to list. Any time that an object is added or removed in somedynamicdatasource, list will be updated to match. This library has over 50 operators including dynamic filters (changing the filter causes the bound collection to be reevaluated), boolean operators (only update the resulting collection if the object is in both source collections or only one), etc.

[1] https://github.com/RolandPheasant/DynamicData




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: