remove IComparable constraint

This commit is contained in:
neuecc 2021-09-10 16:19:57 +09:00
parent 35c4d2eb4d
commit aee0784acf
6 changed files with 10 additions and 10 deletions

View File

@ -51,19 +51,19 @@ namespace ObservableCollections
public static class ObservableCollectionsExtensions
{
public static ISynchronizedView<T, TView> CreateSortedView<T, TKey, TView>(this IObservableCollection<T> source, Func<T, TKey> identitySelector, Func<T, TView> transform, IComparer<T> comparer)
where TKey : IComparable<TKey>
{
return new SortedView<T, TKey, TView>(source, identitySelector, transform, comparer);
}
public static ISynchronizedView<T, TView> CreateSortedView<T, TKey, TView>(this IObservableCollection<T> source, Func<T, TKey> identitySelector, Func<T, TView> transform, IComparer<TView> viewComparer)
where TKey : IComparable<TKey>
{
return new SortedViewViewComparer<T, TKey, TView>(source, identitySelector, transform, viewComparer);
}
public static ISynchronizedView<T, TView> CreateSortedView<T, TKey, TView, TCompare>(this IObservableCollection<T> source, Func<T, TKey> identitySelector, Func<T, TView> transform, Func<T, TCompare> compareSelector, bool ascending = true)
where TKey : IComparable<TKey>
{
return source.CreateSortedView(identitySelector, transform, new AnonymousComparer<T, TCompare>(compareSelector, ascending));
}

View File

@ -7,7 +7,7 @@ using System.Linq;
namespace ObservableCollections.Internal
{
internal class SortedView<T, TKey, TView> : ISynchronizedView<T, TView>
where TKey : IComparable<TKey>
{
readonly IObservableCollection<T> source;
readonly Func<T, TView> transform;

View File

@ -7,7 +7,7 @@ using System.Linq;
namespace ObservableCollections.Internal
{
internal class SortedViewViewComparer<T, TKey, TView> : ISynchronizedView<T, TView>
where TKey : IComparable<TKey>
{
readonly IObservableCollection<T> source;
readonly Func<T, TView> transform;

View File

@ -51,19 +51,19 @@ namespace ObservableCollections
public static class ObservableCollectionsExtensions
{
public static ISynchronizedView<T, TView> CreateSortedView<T, TKey, TView>(this IObservableCollection<T> source, Func<T, TKey> identitySelector, Func<T, TView> transform, IComparer<T> comparer)
where TKey : notnull, IComparable<TKey>
where TKey : notnull
{
return new SortedView<T, TKey, TView>(source, identitySelector, transform, comparer);
}
public static ISynchronizedView<T, TView> CreateSortedView<T, TKey, TView>(this IObservableCollection<T> source, Func<T, TKey> identitySelector, Func<T, TView> transform, IComparer<TView> viewComparer)
where TKey : notnull, IComparable<TKey>
where TKey : notnull
{
return new SortedViewViewComparer<T, TKey, TView>(source, identitySelector, transform, viewComparer);
}
public static ISynchronizedView<T, TView> CreateSortedView<T, TKey, TView, TCompare>(this IObservableCollection<T> source, Func<T, TKey> identitySelector, Func<T, TView> transform, Func<T, TCompare> compareSelector, bool ascending = true)
where TKey : notnull, IComparable<TKey>
where TKey : notnull
{
return source.CreateSortedView(identitySelector, transform, new AnonymousComparer<T, TCompare>(compareSelector, ascending));
}

View File

@ -7,7 +7,7 @@ using System.Linq;
namespace ObservableCollections.Internal
{
internal class SortedView<T, TKey, TView> : ISynchronizedView<T, TView>
where TKey : notnull, IComparable<TKey>
where TKey : notnull
{
readonly IObservableCollection<T> source;
readonly Func<T, TView> transform;

View File

@ -7,7 +7,7 @@ using System.Linq;
namespace ObservableCollections.Internal
{
internal class SortedViewViewComparer<T, TKey, TView> : ISynchronizedView<T, TView>
where TKey : notnull, IComparable<TKey>
where TKey : notnull
{
readonly IObservableCollection<T> source;
readonly Func<T, TView> transform;