Example #1
0
            public IEnumerable <IAtomicOperation> CreateActions(IDocLeaf sender)
            {
                DocList <T>             docList = sender as DocList <T>;
                List <IAtomicOperation> actions = new List <IAtomicOperation>();

                if (NewItems != null)
                {
                    for (int i = 0; i < NewItems.Count; i++)
                    {
                        T obj = (T)NewItems[i];

                        actions.Add(new DocListActionAdd(
                                        sender, NewStartingIndex + i, obj));
                    }
                }

                if (OldItems != null)
                {
                    for (int i = OldItems.Count - 1; i >= 0; i--)
                    {
                        T obj = (T)OldItems[i];

                        actions.Add(new DocListActionRemove(
                                        sender, docList.IndexOf(obj), obj));
                    }
                }

                return(actions);
            }