Utilities: KeyValuePairList: Moved Sort logic to partial class

This commit is contained in:
TalAloni 2020-12-11 00:22:46 +02:00
parent 7599670481
commit 349dcdd320
3 changed files with 45 additions and 32 deletions

View file

@ -4,9 +4,7 @@
* the GNU Lesser Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
namespace Utilities
{
@ -82,36 +80,6 @@ namespace Utilities
}
}
new public void Sort()
{
this.Sort(Comparer<TKey>.Default);
}
public void Sort(ListSortDirection sortDirection)
{
Sort(Comparer<TKey>.Default, sortDirection);
}
public void Sort(IComparer<TKey> comparer, ListSortDirection sortDirection)
{
if (sortDirection == ListSortDirection.Ascending)
{
Sort(comparer);
}
else
{
Sort(new ReverseComparer<TKey>(comparer));
}
}
public void Sort(IComparer<TKey> comparer)
{
this.Sort(delegate(KeyValuePair<TKey, TValue> a, KeyValuePair<TKey, TValue> b)
{
return comparer.Compare(a.Key, b.Key);
});
}
public new KeyValuePairList<TKey, TValue> GetRange(int index, int count)
{
return new KeyValuePairList<TKey, TValue>(base.GetRange(index, count));