Sort list of integers

hey how to sort a list of integers [10,50,30,70,5] in ascending order

@Vinisha
give a try on:
using an assign activity with the statement: yourintlistvar.OrderBy(Function (i) i).ToList

@Vinisha

Create one list variable if type interger and say intergerList and then use sort method to sort it.

      integerList.Sort()
1 Like

kindly note sort() is a sub so it is to use along with an invoke method activity

1 Like

No working… getting an error “Method Not Allowed”

@Vinisha
Do the Sort in advance and Then use the sorted list in the for each

We can use a assign activity like this
Listvariable = Listvariable.OrderBy(Function(x) x).ToList()

Cheers @Vinisha

Also, try changing List1 to an Array of Int32 instead of a List. Unless you plan to remove and add to the list during the process, you should use an Array anyway in my opinion.

can you share the xaml file?

Here you go: sortList.xaml (7.1 KB)

1 Like

thanku

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