You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Christopher-Marcel Böddecker edited this page Oct 10, 2019
·
9 revisions
Dynamic data has always had the capability of applying logic operators to reactive collections. For example, you could combine the results of multiple collections as follows.
vara=newSourceList<int>();varb=newSourceList<int>();varc=newSourceList<int>();varinAny=a.Connect().Or(b.Connect()).Or(c.Connect());//a logical ORvarinAll=a.Connect().And(b.Connect()).And(c.Connect());//a logical ANDvarinOnlyOne=a.Connect().Xor(b.Connect()).Xor(c.Connect());//a logical Exclusive ORvarinFirstAndNotAnyOther=a.Connect().Except(b.Connect()).Except(c.Connect());//a logical Except. i.e. items in a and not (b or c)
From version 4.6 you can now dynamically add or remove collections which are logically combined.
//child lists can be amended any timevarlist1=newSourceList<int>();varlist2=newSourceList<int>();varlist3=newSourceList<int>();varcombined=newSourceList<ISourceList<int>>();//child lists can be added or removed any timecombined.Add(list1);combined.Add(list2);combined.Add(list3);//The operators look after themselves varinAll=combined.And();varinAny=combined.Or();varinOnlyOne=combined.Xor();varinFirstAndNotAnyOther=combined.Except();
These operators produce an observable with the same signature as a single observable list. And even better than that, it is optimised to give the best possible performance.
Exactly the same functionality and semantics apply to the observable cache.