예제 #1
0
        /// <summary>
        /// Sorts the items in the collection by its established keys using the comparer provided.
        /// </summary>
        /// <param name="keyComparison">The key comparison.</param>
        public void SortByKeys(Comparison <TKey> keyComparison)
        {
            var comparer = new ComparisonComparer <TItem>((x, y) => keyComparison(this.GetKeyForItem(x), this.GetKeyForItem(y)));

            this.Sort(comparer);
        }
예제 #2
0
        /// <summary>
        /// Sorts this instance by the provided comparison object.
        /// </summary>
        /// <param name="comparison">The comparison.</param>
        public void Sort(Comparison <TItem> comparison)
        {
            var newComparer = new ComparisonComparer <TItem>(comparison);

            this.Sort(newComparer);
        }