private void OnSourceReset(object sender, ResetEventArgs e) { if (!Is.Trackable(this.ItemType)) { this.Changed?.Invoke(this, RootChangeEventArgs.Create(this, e)); return; } using (var borrow = ListPool <IUnsubscriber <IChildNode <ChangeTrackerNode> > > .Borrow()) { for (var i = 0; i < this.SourceList.Count; i++) { if (this.TryCreateChildNode(i, out var childNode)) { borrow.Value.Add(childNode); } } this.Children.Reset(borrow.Value); this.Changed?.Invoke(this, RootChangeEventArgs.Create(this, e)); } }
private void OnTrackedReset(object sender, ResetEventArgs e) { this.Builder?.ClearIndexDiffs(); using (var borrowed = ListPool <IUnsubscriber <IChildNode <DirtyTrackerNode> > > .Borrow()) { var max = Math.Max(this.XList.Count, this.YList.Count); for (var i = 0; i < max; i++) { this.UpdateIndexDiff(i); var childNode = this.CreateChildNode(i); if (childNode != null) { borrowed.Value.Add(childNode); } } this.Children.Reset(borrowed.Value); } this.TryRefreshAndNotify(e); }