public BehaviorsDisposable ( DisposableBehaviorContainer <T> disposableBehaviorToAdd, BehaviorsDisposable <T> previousBehavior = null ) { if (previousBehavior != null) { previousBehavior ._disposableBehaviors ?.ForEach((dispBehavior) => _disposableBehaviors.Add(dispBehavior)); } _disposableBehaviors.Add(disposableBehaviorToAdd); }
private static BehaviorsDisposable <IEnumerable <T> > AddBehaviorImpl <T> ( this IEnumerable <T> collection, DoForEachItemCollectionBehavior <T> behavior, BehaviorsDisposable <IEnumerable <T> > previousBehavior = null ) { if (collection == null) { return(null); } DisposableBehaviorContainer <IEnumerable <T> > behaviorContainer = new DisposableBehaviorContainer <IEnumerable <T> >(behavior, collection); BehaviorsDisposable <IEnumerable <T> > behaviorsDisposable = new BehaviorsDisposable <IEnumerable <T> >(behaviorContainer, previousBehavior); return(behaviorsDisposable); }