Convert an IEnumerable<> to List<>

How to convert an IEnumerable<> to List<> ?

Resolution

In C#, an IEnumerable can be converted to a List through the following lines of code:

IEnumerable enumerable = Enumerable.Range(1, 300);
List asList = enumerable.ToList();

To achieve the same result in UiPath:

  • Create a List<> variable to store the List.
  • Use an "Assign" activity to convert the IEnumerable<> to a List using the .ToList() method and store it into the List<> variable.

See below for an example:

1.png
1 Like