/* Copyright (C) 2012-2020 Tal Aloni . All rights reserved. * * You can redistribute this program and/or modify it under the terms of * 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.Collections.Generic; using System.ComponentModel; namespace Utilities { public partial class KeyValuePairList { new public void Sort() { this.Sort(Comparer.Default); } public void Sort(ListSortDirection sortDirection) { Sort(Comparer.Default, sortDirection); } public void Sort(IComparer comparer, ListSortDirection sortDirection) { if (sortDirection == ListSortDirection.Ascending) { Sort(comparer); } else { Sort(new ReverseComparer(comparer)); } } public void Sort(IComparer comparer) { this.Sort(delegate(KeyValuePair a, KeyValuePair b) { return comparer.Compare(a.Key, b.Key); }); } } }