コード例 #1
0
        public static async Task <MyNLastObservableCollectionImpl <TItem> > CreateInstance(
            IMyNotifyCollectionChanged <TItem> collection,
            IMyObservableCollectionProxyN proxyN
            )
        {
            Assert.NotNull(collection);
            Assert.NotNull(proxyN);
            var result = new MyNLastObservableCollectionImpl <TItem>();

            result._originCollection = collection;
            result._n = proxyN.N;
            result._stateHelper.SetInitializedState();
            result._subscriptions.Add(
                collection.CollectionChangedObservable.Subscribe(
                    _ =>
            {
                if (result._changedArgsDict.TryAdd(_.ChangesNum, _))
                {
                    result.ProcessNewChangedArgs();
                }
            }
                    )
                );
            result._subscriptions.Add(
                proxyN.NChangedObservable.Subscribe(
                    result.UpdateN
                    )
                );
            using (await result._lockSem.GetDisposable().ConfigureAwait(false))
            {
                await result.ResetActionAsync().ConfigureAwait(false);
            }
            result.ProcessNewChangedArgs();
            return(result);
        }
 public static async Task <MyNFirstObservableCollectionImpl <TItem> > CreateInstance <TItem>(
     IMyNotifyCollectionChanged <TItem> collection,
     IMyObservableCollectionProxyN proxyN
     )
 {
     return(await MyNFirstObservableCollectionImpl <TItem> .CreateInstance(
                collection,
                proxyN
                ).ConfigureAwait(false));
 }