| | | 1 | | // ----------------------------------------------------------------------- |
| | | 2 | | // <copyright file="CollectionExtensions.cs" company="Stéphane ANDRE"> |
| | | 3 | | // Copyright (c) Stéphane ANDRE. All rights reserved. |
| | | 4 | | // </copyright> |
| | | 5 | | // ----------------------------------------------------------------------- |
| | | 6 | | |
| | | 7 | | using System; |
| | | 8 | | using System.Reactive.Concurrency; |
| | | 9 | | using MyNet.Collections; |
| | | 10 | | using MyNet.Observable.Collections; |
| | | 11 | | |
| | | 12 | | #pragma warning disable IDE0130 // Namespace does not match folder structure |
| | | 13 | | namespace MyNet.Observable; |
| | | 14 | | #pragma warning restore IDE0130 // Namespace does not match folder structure |
| | | 15 | | |
| | | 16 | | /// <summary> |
| | | 17 | | /// Scheduling helpers for observable range collections. |
| | | 18 | | /// </summary> |
| | | 19 | | public static class CollectionExtensions |
| | | 20 | | { |
| | | 21 | | /// <summary> |
| | | 22 | | /// Wraps an observable range collection so notifications are dispatched on the specified Rx scheduler. |
| | | 23 | | /// </summary> |
| | | 24 | | public static DispatchedObservableCollection<T> Scheduled<T>(this ObservableRangeCollection<T> collection, ISchedule |
| | | 25 | | { |
| | 0 | 26 | | ArgumentNullException.ThrowIfNull(collection); |
| | 0 | 27 | | ArgumentNullException.ThrowIfNull(scheduler); |
| | 0 | 28 | | return new(collection, new SchedulerCollectionEventDispatcher(scheduler)); |
| | | 29 | | } |
| | | 30 | | } |
| | | 31 | | |