mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-08-03 06:21:49 +02:00
Utilities: KeyValuePairList: Moved Sort logic to partial class
This commit is contained in:
parent
7599670481
commit
349dcdd320
3 changed files with 45 additions and 32 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue