fix ObserveSort comparer nullable annotation

This commit is contained in:
neuecc 2024-09-04 08:53:19 +09:00
parent dce0bb6189
commit 7a573289ea
2 changed files with 7 additions and 7 deletions

View File

@ -71,7 +71,7 @@ public static class ObservableCollectionR3Extensions
return new ObservableCollectionReverse<T>(source, cancellationToken); return new ObservableCollectionReverse<T>(source, cancellationToken);
} }
public static Observable<(int Index, int Count, IComparer<T> Comparer)> ObserveSort<T>(this IObservableCollection<T> source, CancellationToken cancellationToken = default) public static Observable<(int Index, int Count, IComparer<T>? Comparer)> ObserveSort<T>(this IObservableCollection<T> source, CancellationToken cancellationToken = default)
{ {
return new ObservableCollectionSort<T>(source, cancellationToken); return new ObservableCollectionSort<T>(source, cancellationToken);
} }
@ -290,18 +290,18 @@ sealed class ObservableCollectionReverse<T>(IObservableCollection<T> collection,
} }
} }
sealed class ObservableCollectionSort<T>(IObservableCollection<T> collection, CancellationToken cancellationToken) : Observable<(int Index, int Count, IComparer<T> Comparer)> sealed class ObservableCollectionSort<T>(IObservableCollection<T> collection, CancellationToken cancellationToken) : Observable<(int Index, int Count, IComparer<T>? Comparer)>
{ {
protected override IDisposable SubscribeCore(Observer<(int Index, int Count, IComparer<T> Comparer)> observer) protected override IDisposable SubscribeCore(Observer<(int Index, int Count, IComparer<T>? Comparer)> observer)
{ {
return new _ObservableCollectionSort(collection, observer, cancellationToken); return new _ObservableCollectionSort(collection, observer, cancellationToken);
} }
sealed class _ObservableCollectionSort( sealed class _ObservableCollectionSort(
IObservableCollection<T> collection, IObservableCollection<T> collection,
Observer<(int Index, int Count, IComparer<T> Comparer)> observer, Observer<(int Index, int Count, IComparer<T>? Comparer)> observer,
CancellationToken cancellationToken) CancellationToken cancellationToken)
: ObservableCollectionObserverBase<T, (int Index, int Count, IComparer<T> Comparer)>(collection, observer, cancellationToken) : ObservableCollectionObserverBase<T, (int Index, int Count, IComparer<T>? Comparer)>(collection, observer, cancellationToken)
{ {
protected override void Handler(in NotifyCollectionChangedEventArgs<T> eventArgs) protected override void Handler(in NotifyCollectionChangedEventArgs<T> eventArgs)
{ {

View File

@ -25,9 +25,9 @@ namespace ObservableCollections
Comparer = comparer ?? NullComparerSentinel.Instance; Comparer = comparer ?? NullComparerSentinel.Instance;
} }
public (int Index, int Count, IComparer<T> Comparer) AsTuple() public (int Index, int Count, IComparer<T>? Comparer) AsTuple()
{ {
return (Index, Count, Comparer!); return (Index, Count, Comparer);
} }
public static SortOperation<T> CreateReverse(int index, int count) public static SortOperation<T> CreateReverse(int index, int count)