Esempio n. 1
0
 public void Sort(CompareItemsCallback compare)
 {
     int    x     = 0;
     int    y     = 1;
     object item1 = arr[x];
     object item1 = arr[y];
     int    order = compare(item1, item2);
 }
Esempio n. 2
0
 public void Sort(CompareItemsCallback compare)
 {
     // not a real sort, just shows what the
     // inner loop code might do
     int    x     = 0;
     int    y     = 1;
     object item1 = arr[x];
     object item2 = arr[y];
     int    order = compare(item1, item2);
 }
Esempio n. 3
0
        // This method will sort the list of employees.
        internal void Sort(CompareItemsCallback sortingMethod)
        {
            // Loop to compare numbers for sorting.
            for (int i=1; i < _employeeList.Count; i++)
            {
                int j = i;
                Employee e = (Employee)_employeeList[i];

                // Swap employees if they are out of order.
                while ((j>0) && sortingMethod((Employee)_employeeList[j-1], e) >= 0)
                {
                    _employeeList[j] = _employeeList[j-1];
                    j--;
                }

                _employeeList[j] = e;
            }
        }