This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.ObjectModel; | |
using System.Linq; | |
using System.Reactive; | |
using System.Reactive.Linq; | |
using DynamicData.Binding; | |
using FluentAssertions; | |
using ReactiveUI; | |
using Xunit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Collections.ObjectModel; | |
using System.Linq; | |
using System.Reactive.Linq; | |
using System.Text; | |
using System.Threading; | |
using DynamicData.Binding; | |
using Xunit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Threading; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Engines; | |
using DynamicData.Kernel; | |
namespace DynamicData.Benchmarks.List | |
{ | |
[CoreJob] | |
[MarkdownExporterAttribute.GitHub] | |
public class LockingBenchmarks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DynamicDataEx | |
{ | |
/// <summary> | |
/// Transforms the items, and when an update is received, allows the preservation of the previous view model | |
/// </summary> | |
/// <typeparam name="TObject">The type of the object.</typeparam> | |
/// <typeparam name="TKey">The type of the key.</typeparam> | |
/// <typeparam name="TDestination">The type of the destination.</typeparam> | |
/// <param name="source">The source.</param> | |
/// <param name="transformFactory">The transform factory.</param> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyCalendarEntry | |
{ | |
public int Id { get; } | |
public DateTime DateTime { get; } | |
public string Entry { get; } | |
public MyCalendarEntry(int id, DateTime dateTime, string entry) | |
{ | |
Id = id; | |
DateTime = dateTime; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ObservableEx | |
{ | |
public static IObservable<IChangeSet<T>> BufferInitial<T>(this IObservable<IChangeSet<T>> source, TimeSpan initalBuffer, IScheduler scheduler = null) | |
{ | |
return source.DeferUntilLoaded().Publish(shared => | |
{ | |
var initial = shared.Buffer(initalBuffer, scheduler ?? Scheduler.Default) | |
.FlattenBufferResult() | |
.Take(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ListFilterPerf | |
{ | |
private static readonly ICollection<int> Items = Enumerable.Range(1, 1_000_000).ToList(); | |
[Fact] | |
public void ListOnly_Range() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Reactive.Disposables; | |
using System.Reactive.Linq; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace DynamicData.Tests.List | |
{ | |
public static class ObservableChangeSet | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This example works with observable collection. When using reactive list add package DynamicData.ReactiveUI (Use dynamic data v4x - later version are based off rx3x with rxui does not support) | |
* Normally with dd you would manage a collection independent of binding i.e. use SourceCache<T,K> or SourceList<T>, shape the collection and uae the Bind() operator to maintain an observable collection. See github homepage for links and examples | |
*/ | |
ObservableCollection<A> listOfA = new ObservableCollection<A>(); | |
//create a collection to bind to | |
ReadOnlyObservableCollection<B> binding; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//expand out the locations and create an ExpandableGroup which contains an inner cache of locations | |
IObservableCache<ExpandableGroup<Location>, GroupType> grouped = _internalLocations.Connect() | |
.TransformMany(CreateGroups, lwg => lwg.Key) //select one or more locations with a grouing | |
.Group(lwg => lwg.Type) //Create a nested cache | |
.Transform(grouping => | |
{ | |
//get original location back out of the grouping | |
var innerCache = grouping.Cache | |
.Connect() | |
.Transform(lwg => lwg.Location) |