当前位置: 首页>>代码示例>>C#>>正文


C# ObservableList.ToLiveLinq方法代码示例

本文整理汇总了C#中ObservableList.ToLiveLinq方法的典型用法代码示例。如果您正苦于以下问题:C# ObservableList.ToLiveLinq方法的具体用法?C# ObservableList.ToLiveLinq怎么用?C# ObservableList.ToLiveLinq使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ObservableList的用法示例。


在下文中一共展示了ObservableList.ToLiveLinq方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RemoveItemAfterSubscribing

 public void RemoveItemAfterSubscribing()
 {
     var source = new ObservableList<ObservableList<string>>();
     ImmutableList<string> result = ImmutableList<string>.Empty;
     source.ToLiveLinq()
         .SelectMany((list, _) => list.ToLiveLinq())
         .ToObservableEnumerable().Subscribe(value => result = value);
     source.Add(new ObservableList<string>());
     source.RemoveAt(0);
     result.Should().BeEmpty();
 }
开发者ID:ApocalypticOctopus,项目名称:Apocalyptic.Utilities.Net,代码行数:11,代码来源:SelectManyObservableCollectionTests.cs

示例2: DisposeSubscription_ThenRemoveItem

 public void DisposeSubscription_ThenRemoveItem()
 {
     var source = new ObservableList<ObservableList<string>>();
     ImmutableList<string> result = ImmutableList<string>.Empty;
     var subscription = source.ToLiveLinq()
         .SelectMany((list, _) => list.ToLiveLinq())
         .ToObservableEnumerable().Subscribe(value => result = value);
     source.Add(new ObservableList<string>());
     source.Add(new ObservableList<string>());
     source[0].Add("a");
     source[1].Add("c");
     subscription.Dispose();
     source.RemoveAt(1);
     result.Should().ContainInOrder("a", "c");
 }
开发者ID:ApocalypticOctopus,项目名称:Apocalyptic.Utilities.Net,代码行数:15,代码来源:SelectManyObservableCollectionTests.cs

示例3: WhereThenSelect

        public void WhereThenSelect()
        {
            var coll1 = new ObservableList<SelectObservableCollectionViewModel>();
            var result = coll1.ToLiveLinq().Where(nested => nested.Name.Select(val => val.Length > 2).Snapshot())
                .Select(nested => nested.Name.AsObservable()).ToReadOnlyObservableList();
            result.Count.Should().Be(0);

            coll1.Add(new SelectObservableCollectionViewModel(string.Empty));
            result.Count.Should().Be(0);

            coll1[0].Name.Value = "test";
            result.Count.Should().Be(1);
            result[0].Should().Be("test");

            coll1[0].Name.Value = "test2";
            result.Count.Should().Be(1);
            result[0].Should().Be("test2");

            coll1[0].Name.Value = "t";
            result.Count.Should().Be(0);
        }
开发者ID:ApocalypticOctopus,项目名称:Apocalyptic.Utilities.Net,代码行数:21,代码来源:ObservableCollectionTests.cs

示例4: AddItemAfterSubscribing_AddSubItemsAfterSubscribing

 public void AddItemAfterSubscribing_AddSubItemsAfterSubscribing()
 {
     var source = new ObservableList<ObservableList<string>>();
     ImmutableList<string> result = ImmutableList<string>.Empty;
     source.ToLiveLinq()
         .SelectMany((list, _) => list.ToLiveLinq())
         .ToObservableEnumerable().Subscribe(value => result = value);
     source.Add(new ObservableList<string>());
     source.Add(new ObservableList<string>());
     source[0].Add("a");
     source[0].Add("b");
     source[1].Add("c");
     source[1].Add("d");
     result.Should().ContainInOrder("a", "b", "c", "d");
 }
开发者ID:ApocalypticOctopus,项目名称:Apocalyptic.Utilities.Net,代码行数:15,代码来源:SelectManyObservableCollectionTests.cs

示例5: AddItemBeforeSubscribing_AddSubItemsBeforeSubscribing_RemoveSubItemsAfterSubscribing

 public void AddItemBeforeSubscribing_AddSubItemsBeforeSubscribing_RemoveSubItemsAfterSubscribing()
 {
     var source = new ObservableList<ObservableList<string>>();
     ImmutableList<string> result = ImmutableList<string>.Empty;
     source.Add(new ObservableList<string>());
     source.Add(new ObservableList<string>());
     source[0].Add("a");
     source[0].Add("b");
     source[1].Add("c");
     source[1].Add("d");
     source.ToLiveLinq()
         .SelectMany((list, _) => list.ToLiveLinq())
         .ToObservableEnumerable().Subscribe(value => result = value);
     source[0].Clear();
     source[1].Clear();
     result.Should().BeEmpty();
 }
开发者ID:ApocalypticOctopus,项目名称:Apocalyptic.Utilities.Net,代码行数:17,代码来源:SelectManyObservableCollectionTests.cs


注:本文中的ObservableList.ToLiveLinq方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。