Small loops: Invoke Code vs UiPath Activity

Hello All,

while working on a project i found my self needing to convert a collumn of Double to String to format to be sent in an email.

now i know there are atleast 2 ways to do this…

Option 1) using standard for each row Activity with an Assign row(“ColumnName”) = Convert.ToDouble(row(“ColumnName”)

Option 2) Using Invoke Code Activity with the following arguments and code
Arguments
dt AsDatatable In/Out
row AsDatarow In

For Each row in dt.AsEnumerable
row(“ColumnName”) = Convert.ToDouble(row(“ColumnName”)
Next row

i was just wondering what is the best practice is when it comes to these small loops that would have a single assign activity in them.

Hi @njad91

Both of them works in same way which differs in just seconds
But comparatively second one is faster instead of looping in with for each row activity because if there are large number of rows it impacts a bit

Cheers