Skip to content

Instantly share code, notes, and snippets.

@kijuky
Created October 2, 2013 15:47
Show Gist options
  • Select an option

  • Save kijuky/6795856 to your computer and use it in GitHub Desktop.

Select an option

Save kijuky/6795856 to your computer and use it in GitHub Desktop.
enum X { X1, X2, X3 }
enum Y { Y1, Y2, Y3 }
enum Z { Z1, Z2, Z3 }
foreach( a in
from z in new[]{ Z1, Z2, Z3 }
from y in new[]{ Y1, Y2, Y3 }
from x in new[]{ X1, X2, X3 }
select new { x, y, z })
Console.WriteLine(a);
/* output:
X1, Y1, Z1
X2, Y1, Z1
X3, Y1, Z1
X1, Y2, Z1
X2, Y2, Z1
X3, Y2, Z1
X1, Y3, Z1
X2, Y3, Z1
X3, Y3, Z1
X1, Y1, Z2
X2, Y1, Z2
X3, Y1, Z2
X1, Y2, Z2
X2, Y2, Z2
X3, Y2, Z2
X1, Y3, Z2
X2, Y3, Z2
X3, Y3, Z2
X1, Y1, Z3
X2, Y1, Z3
X3, Y1, Z3
X1, Y2, Z3
X2, Y2, Z3
X3, Y2, Z3
X1, Y3, Z3
X2, Y3, Z3
X3, Y3, Z3
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment