Skip to content

Instantly share code, notes, and snippets.

@anaisbetts
Created April 4, 2011 22:41
Show Gist options
  • Select an option

  • Save anaisbetts/902622 to your computer and use it in GitHub Desktop.

Select an option

Save anaisbetts/902622 to your computer and use it in GitHub Desktop.
// This is the WPF/Silverlight ObservableCollection, not from Rx at all!
ObservableCollection<MyCoolModel> modelCollection;
model.Length
>>> 4
// Create a View Model Collection that will track the Model collection
var viewModelCollection = modelCollection.CreateDerivedCollection(
x => new MyCoolViewModel(x));
viewModelCollection.Length
>>> 4
// Now, changes to modelCollection are mirrored in viewModelCollection
modelCollection.Add(new MyCoolModel());
viewModelCollection.Length
>>> 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment