Hi
I wan’t to use this function code in RPA process:
getCombinations-code.txt (1.1 KB)
How to add this in a Invoke Code?
I put this code into invoke code (C#) activity
IEnumerable GetCombinations(int Set,int sum,String values) {
for (int i = 0; i < set.Length; i++) {
int left = sum - set[i];
string vals = set[i] + “,” + values;
if (left == 0) {
yield return vals;
} else {
int possible = set.Take(i).Where(n => n <= sum).ToArray();
if (possible.Length > 0) {
foreach (string s in GetCombinations(possible, left, vals)) {
yield return s;
}
}
}
}
}
There is some error:
No compiled code to run
error CS1513: } AT line -1
error CS1022 Type or namespace definition, or end-of-file expected AT line 17