Reverse the list

Hi All,

Anyone please help to resolve this issue.
While reversing list data I am facing error as “Expression does not produce a value”.

I have used the code as (List_of_string_variable.Reverse).

Thanks in advance,

Reverse doesn’t produce a value. Exactly what it says. No value is produced, so you can’t assign it to lst_reversed. It directly reverses the values right in str_splited_list (which is an array, not a list). You need to use Invoke Method:


(ignore the error indicator, it’s just because I didn’t create a variable with that name)

HI @Moni_1234

Check out this expression

ListValue = "A,B,C,D"




FYI, there are 2 types Reverse method in .net.

  • List<T>.Reverse

This method returns no value. As @postwick shows, we need to use InvokeMethod activity.

  • Enumerable<T>.Reverse

This method returns IEnumerble<T>. So, as @Gokul001 shows, we can use this in expression or in Assign activity as the following.

 listReverse = listValue.AsEnumerable().Reverse().ToList()

It seems List<T>.Reverse has priority in Wnidows legacy, Enumerable<T>.Reverse has priority in Windows.


1 Like

Hey, @postwick it is not working … I have Tried it

1 Like

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