コード例 #1
0
 private static IEnumerable <CollectionOperation <T> > Enumerate([NotNull] ICollectionInsertOperation <T> insert)
 {
     foreach (var item in insert.Items)
     {
         yield return(CollectionOperation <T> .OnAdd(item));
     }
 }
コード例 #2
0
                protected override IEnumerable <CollectionOperation <TAdaptee> > Enumerate()
                {
                    foreach (var update in _adaptee.Operations())
                    {
                        switch (update.Type)
                        {
                        case CollectionOperationType.Add:
                            var added = _state.Get(update.Item, _removedOnChange);
                            yield return(CollectionOperation <TAdaptee> .OnAdd(added));

                            break;

                        case CollectionOperationType.Remove:
                            var removed = _state.Get(update.Item, _removedOnChange);
                            yield return(CollectionOperation <TAdaptee> .OnRemove(removed));

                            break;

                        case CollectionOperationType.Clear:
                            yield return(CollectionOperation <TAdaptee> .OnClear());

                            break;

                        default:
                            throw new ArgumentOutOfRangeException();
                        }
                    }
                }
コード例 #3
0
            public IEnumerable <CollectionOperation <TAdaptee> > Operations()
            {
                foreach (var u in _adaptee.Operations())
                {
                    switch (u.Type)
                    {
                    case CollectionOperationType.Add:
                        yield return(CollectionOperation <TAdaptee> .OnAdd(_selector(u.Item)));

                        break;

                    case CollectionOperationType.Remove:
                        yield return(CollectionOperation <TAdaptee> .OnRemove(_selector(u.Item)));

                        break;

                    case CollectionOperationType.Clear:
                        yield return(CollectionOperation <TAdaptee> .OnClear());

                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }
            }
コード例 #4
0
        private static IEnumerable <CollectionOperation <T> > Enumerate([NotNull] ICollectionResetOperation <T> reset)
        {
            yield return(CollectionOperation <T> .OnClear());

            if (reset.Items != null)
            {
                foreach (var item in reset.Items)
                {
                    yield return(CollectionOperation <T> .OnAdd(item));
                }
            }
        }
コード例 #5
0
        private static IEnumerable <CollectionOperation <T> > Enumerate([NotNull] ICollectionReplaceOperation <T> replace)
        {
            yield return(CollectionOperation <T> .OnRemove(replace.ReplacedItem));

            yield return(CollectionOperation <T> .OnAdd(replace.Item));
        }