CSharp · Console
using System;
using System.Collections.Generic;
using System.Linq;
public class Program
{
public static void Main()
{
IOrderedEnumerable<int> o = new[] { 1, 2, 3, 2, 1 }.Order(Comparer<int>.Create((a, b) => (a % 2) - (b % 2)));
// prints 2, 2, 1, 3, 1
Console.WriteLine(string.Join(", ", o));
}
}