using System; class Bubble {
static void Sort<T>
(Func<T,T,bool> Less, T [] a) { ...
if (Less (a[j+1],a[j])) { ... } }
public static void Main (string [] argv) {
int [] a = { 4,1,2,3 };
Sort<int> ((int x, int y) => x <= y, a);
foreach (var x in a) Console.Write (x);
} }
Ü: (allgemeinster) Typ und Implementierung
einer Funktion
Flip, die den Vergleich umkehrt:
Sort<int> (Flip( (x,y)=> x <= y ), a)