I need a way to generate all combinations (NOT permutations) of elements in a list in C# (non-repeating, order does not matter).
I have seen several solutions that propose using recursion, however they require building the entire list before returning (memory inefficient).
I was hoping there is a way to create a generator that could yield the current combination without storing all other combinations during its iteration. Does anyone know of any efficient solutions?