コード例 #1
0
 public static CompositeDisposable KeepCollectionInSyncOfType <T, T2>(this IReactiveList <T2> list,
                                                                      IList <T2> destination, Func <T, bool> filter = null)
     where T : class, T2 where T2 : class
 {
     if (list == null)
     {
         throw new ArgumentNullException(nameof(list));
     }
     if (destination == null)
     {
         throw new ArgumentNullException(nameof(destination));
     }
     lock (list) {
         list.SyncCollectionOfTypeLocked(destination, filter);
         return(list.TrackChangesOfType(destination.Add, x => destination.Remove(x),
                                        reset => reset.SyncCollectionOfTypeLocked <T, T2>(destination), filter));
     }
 }