AcornPublishing_essential-csharp-7e/EssentialCSharp-8.0/src/Chapter13/Listing13.07.DeclaringAFuncCompatibleMethod.cs
namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter13.Listing13_07
{
    using System;

     class DelegateSample
    {
        public static void BubbleSort(
            int[] items, Func<int, int, bool> compare)
        {
            int i;
            int j;
            int temp;

            if(items == null)
            {
                return;
            }
            if(compare == null)
            {
                throw new ArgumentNullException(nameof(compare));
            }

            for(i = items.Length - 1; i >= 0; i--)
            {
                for(j = 1; j <= i; j++)
                {
                    if(compare(items[j - 1], items[j]))
                    {
                        temp = items[j - 1];
                        items[j - 1] = items[j];
                        items[j] = temp;
                    }
                }
            }
        }

        public static bool GreaterThan(int first, int second)
        {
            return first > second;
        }

        // ...
    }
}