C# split a list into all combinations of n groups - code migration from Python
问题 There is a great implementation of the algorithm I am after here (by @lazy dog). However, I need this in c# and the conversion is not trivial due to C#'s lack of yield from and perhaps my own thickheadedness. Here is what I currently have: public static IEnumerable<ArrayList> sorted_k_partitions(int[] seq, int k) { var n = seq.Length; var groups = new ArrayList(); //a list of lists, currently empty IEnumerable<ArrayList> generate_partitions(int i) { if (i >= n) { // this line was the bug, was