# How to sort a String array using the InvokeMethod activity

**URL:** <https://forum.uipath.com/t/invokemethod-string-sort/4984558>\
**Category:** フォーラム\
**Created:** [September 1, 2025, 3:21am UTC](https://forum.uipath.com/t/invokemethod-string-sort/4984558 "2025-09-01T03:21:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gorby](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gorby/32/543563_2.png) [@gorby](https://forum.uipath.com/u/gorby)\
**Post date:** [September 1, 2025, 3:21am UTC](https://forum.uipath.com/t/invokemethod-string-sort/4984558/1 "2025-09-01T03:21:07Z")

</div>

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.

 ![Untitled](https://global.discourse-cdn.com/uipath/original/4X/4/5/4/454e91a8eeefd4b272aab30212e62bc7d4b15428.png)

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.

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [September 1, 2025, 3:40am UTC](https://forum.uipath.com/t/invokemethod-string-sort/4984558/2 "2025-09-01T03:40:01Z")

</div>

> [@gorby](#):
>
> 1. Is it impossible to sort a String array using the Invoke Method 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).

> **[Array.Sort メソッド (System)](https://learn.microsoft.com/ja-jp/dotnet/api/system.array.sort?view=net-8.0)**
>
> 1 次元配列内の要素を並べ替えます。

> 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.

> **[Array.Reverse メソッド (System)](https://learn.microsoft.com/ja-jp/dotnet/api/system.array.reverse?view=net-8.0)**
>
> 1 次元の Array または Arrayの一部の要素の順序を反転します。

 ![image](https://global.discourse-cdn.com/uipath/original/4X/7/9/f/79f6122e34b47c74bd58ea6483f884109e94e508.png)

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [September 4, 2025, 3:40am UTC](https://forum.uipath.com/t/invokemethod-string-sort/4984558/3 "2025-09-04T03:40:35Z")

</div>

Closed on September 4, 2025, 3:40am UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
