How to use Methods(Insert, Sort, AddRange, Contains, Remove) for List Variable

I have a List Variable. according to C# language, we have methods for List Variables.The methods Are
Insert, Sort, AddRange, Contains, Remove like that we have some more.
I want to perform this method in Ui Path. How?when I tried but getting errors.

So please any Solve this and send me this workflow

Thanks in Advance .
Chinnapu Reddy

What error you are getting…??

@chinnapureddy03
Suppose if ur having a list varaiable Lst A - List of strings.
ListB-List of strings , Where you want add it to ListA

Let us take stra which you want alter in the list ListA

1.ListA.Add(stra)
2.ListA.Sort()
3.ListA.Contains(stra)
4.ListA.AddRange(ListB)
5.List.Remove(stra)
6.ListA.Insert(Position,stra)

position-the index where you want to insert the string.

Regards,
Mahesh

HI @chinnapureddy03,

Refer this xaml file to how to add to value in the list
invoke_list.xaml (6.9 KB)

Regards,
Arivu

2 Likes

Thanks @arivu96

How about remove from list at index position?

Hi @FlpVsg,

You can use Remove at like below

File : LstRemove.zip (1.8 KB)

Regards
Balamurugan

3 Likes

Thanks!

Invoke Method looks like an ugly way, but it works for some methods.
Can you please give me an advice how can I use System.Collections.Generic.List’s AddRange() method?
I am still getting error:

‘List`1’ does not have a public instance method named ‘AddRange’ matching the parameter types, generic type arguments, and generic type constraints supplied to InvokeMethod ‘Invoke method’

4 Likes

obraz