// SortExtensionLibrary.cs
// Copyright (c) 2016 Bentley Systems, Incorporated. All Rights Reserved.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Haestad.Framework.UI.Integration
{
    // Source:
    // http://stackoverflow.com/questions/15486/sorting-an-ilist-in-c-sharp

    /// <summary>
    /// Class provides generic extension methods.
    /// </summary>
    public static class SortExtensionLibrary
    {
        //  Sorts an IList<T> in place.
        public static void Sort<T>(this IList<T> list, Comparison<T> comparison)
        {
            ArrayList.Adapter((IList)list).Sort(new ComparisonComparer<T>(comparison));
        }
    }
}
