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
This code function want to find out several combinations in the set of number such that the summation of it equal to a known number, for example, 18. We can find out that 5, 6, 7 is matched (5+6+7=18).:
This code run suscessful:
UiPath removed C# support (see links below) because they couldn’t get it working reliably. Looks like you ran into one of these issues. I would avoid C# until they’re resolved by UiPath.
If you must continue to try to use it, you can remove bits of your code until you find the bit that’s breaking it. Looks like you can also simplify that code quite a bit - try a simple for loop.