How to sort a String array using the InvokeMethod activity

Hello,
I’m a user of UiPath Studio 2025.0.172STS Community edition.

I have two questions.

  1. Is it impossible to sort a String array using the invokeMethod activity?
    I was able to sort a list variable using the invokeMethod activity, so I thought it might be possible with a String array as well. I tried it, but a static error occurred and it wouldn’t run. I look forward to hearing from anyone knowledgeable about this.

  1. If the answer to 1 is YES, please also tell me how to sort a String array in reverse order using the invokeMethod activity.

It is possible. Array.Sort is a static method, so instead of operating on an instance, try specifying the instance as an argument, as in Array.Sort(varArray).

  1. If the answer to 1 is YES, please also explain how to sort a list variable in reverse order using the Invoke Method activity.

Call the Array.Reverse() method. Like Sort, it is a static method, so specify the instance as an argument.