ListPool icon indicating copy to clipboard operation
ListPool copied to clipboard

ListPool.Sort

Open mastef opened this issue 1 year ago • 0 comments

Very cool project, we like it a lot.

Only thing that we're kind of missing are the sort methods

        public void Sort(Comparison<T> comparison);
        public void Sort(int index, int count, IComparer<T> comparer);
        public void Sort();
        public void Sort(IComparer<T> comparer);

I think it would be as simple as

	public void Sort() => Sort(0, Count, null);
	public void Sort(IComparer<T> comparer) => Sort(0, Count, comparer);
	public void Sort(int index, int count, IComparer<T> comparer) => Array.Sort<T>(_items, index, count, comparer);
	public void Sort(Comparison<T> comparison) => Array.Sort<T>(_items, 0, Count, Comparer<T>.Create(comparison));

mastef avatar May 31 '24 04:05 mastef