private static void CollectionTestClass_TheCollectionValueChangedEvent ( ObservableCollection <MyNotifiablePropsTestClass> collection ) { _disposableBehaviors?.Dispose(); // chain the two behaviors - one to record the // changed property value, the other to maintain // NumberItemsInCollection of the same size as // the collection. _disposableBehaviors = collection .AddBehavior ( item => item.PropertyChanged += Item_PropertyChanged, item => item.PropertyChanged -= Item_PropertyChanged ) .AddBehavior ( item => NumberItemsInCollection++, item => NumberItemsInCollection-- ); }