Skip to content

Instantly share code, notes, and snippets.

@runceel
Created November 11, 2015 02:35
Show Gist options
  • Save runceel/04f7d1568fcc3415628d to your computer and use it in GitHub Desktop.
Save runceel/04f7d1568fcc3415628d to your computer and use it in GitHub Desktop.
var a = new ObservableCollection<string>();
var b = new ObservableCollection<string>();
var rc = a.ToCollectionChanged()
.Merge(b.ToCollectionChanged().Select(x => new CollectionChanged<string>
{
Action = x.Action,
Index = x.Index + a.Count,
OldIndex = x.OldIndex + a.Count,
Value = x.Value,
}))
.ToReadOnlyReactiveCollection();
a.Add("a");
b.Add("b");
b.Add("c");
b.Remove("b");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment