How to Invoke This c# code?

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

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:

paste this code in to Invoke code activity there some error,I have not solved it.
Please help
Thanks

My understanding is C# support has been removed from UIPath.


See the Invoke code option, the function is still there, there may be any restrictions on the C # I input?
Thanks

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.

@Chao

You can convert your code to vb.net.
https://converter.telerik.com/

c# to vb.net and vice- versa
Paste this vb.net code to the invoke method. if any error still lets know.

if you have converted the code , could you paste it here. thanks