Ejemplo n.º 1
0
 public ChangeTrackingList(Collection <T> list)
     : base(list)
 {
     // Add items to the change tracking list
     foreach (T item in list)
     {
         changeTracker.Add(item);
     }
 }
Ejemplo n.º 2
0
        public ChangeTrackingHelper <T> GetChanges()
        {
            // 重建新的ChangeTrackingList
            ChangeTrackingHelper <T> changes = new ChangeTrackingHelper <T>();

            foreach (T existing in this)
            {
                if (existing.TrackingState != TrackingInfo.Unchanged)
                {
                    changes.Add(existing);
                }
            }

            // Append deleted items
            foreach (T deleted in deletedItems)
            {
                changes.Add(deleted);
            }
            return(changes);
        }