using System.Collections.Generic;
public static void Main()
foreach (var combination in GetValues()) {
foreach (var v in combination) {
public static IEnumerable<List<string>> GetValues() {
var fields = new List<string>() {
for (int i = 0; i < (1 << fields.Count); i++) {
yield return ConstructBits(i).Select(n => fields[n]).ToList();
public static IEnumerable<int> ConstructBits(int i) {
for (int n = 0; i != 0; i /= 2, n++) {
if ((i & 1) != 0) yield return n;