public static BehaviorsDisposable <IEnumerable <TCollItem> > AddBehavior <TCollItem> ( this IEnumerable <TCollItem> collection, DoForEachItemCollectionBehavior <TCollItem> behavior ) { return(collection.AddBehaviorImpl(behavior)); }
private static BehaviorsDisposable <IEnumerable <TCollItem> > AddBehaviorImpl <TCollItem> ( this IEnumerable <TCollItem> collection, Action <TCollItem> onAdd, Action <TCollItem> onRemove = null, BehaviorsDisposable <IEnumerable <TCollItem> > previousBehavior = null ) { DoForEachItemCollectionBehavior <TCollItem> behavior = new DoForEachItemCollectionBehavior <TCollItem>(onAdd, onRemove); return(collection?.AddBehaviorImpl <TCollItem>(behavior, previousBehavior)); }
private static BehaviorsDisposable <IEnumerable <TCollItem> > AddBehaviorImpl <TCollItem> ( this IEnumerable <TCollItem> collection, DoForEachItemCollectionBehavior <TCollItem> behavior, BehaviorsDisposable <IEnumerable <TCollItem> > previousBehavior = null ) { if (collection == null) { return(null); } DisposableBehaviorContainer <IEnumerable <TCollItem> > behaviorContainer = new DisposableBehaviorContainer <IEnumerable <TCollItem> >(behavior, collection); BehaviorsDisposable <IEnumerable <TCollItem> > behaviorsDisposable = new BehaviorsDisposable <IEnumerable <TCollItem> >(behaviorContainer, previousBehavior); return(behaviorsDisposable); }