using System;
using System.Linq;
public class Program
{
class Foo
static int counter;
public int Id;
public Foo()
Id = counter++;
}
public static void Main()
var src = Enumerable.Range(1, 10).Select(_ => new Foo());
var sorted = src.OrderBy(_ => _.Id % 2).ThenBy(_ => _.Id % 4);
Console.WriteLine(string.Join(";", sorted.Select(_ => _.Id)));