Am trying to understand how to use code, so getting confuse
Step1 . I have used List with initalization as New List(Of Int32) from {1,4,6,3,7,2,4,9,6}, assigned to list1 variable which is of type System.collection.generic.List
Now I want to find Min as example,
so I have written list1.Min and getting expected value.
But If I try use Invoke Method assigning as Target object list1 and MethodName as Min, getting an error.
Same thing I have tried for other methods for some of Invoke method is working and for some of in assign it is working…Need some clarification
The error you are encountering happens because Min is an extension method provided by the System.Linq namespace and not a direct method of the List<T> class. To use such methods in UiPath, you need to use the Invoke Code activity instead of the Invoke Method activity.
The syntax used within Assign activity is the right one to use list1.Min.
Previous question I got clarification, Thank you.
I have one more doute
I have list need to find distinct, so I have used list1.Distinct().Tolist and got the result.
But why to choose .ToList and when we need to choose.
The purpose of list1.Distinct().ToList() is to create a new list that contains only the unique elements from the original list1, without any duplicates.
Last question…
for adding items in the list, we will use Invoke method.
we cannot use assign and add the items. without converting into String and Concat or without using linq