Can we create multiple empty data table dynamically?

Hello All,

I want to create 10 empty DataTable dynamically.
Is there a way to create multiple empty data tables , without having to create 10 variable / argument of datatype DataTable for it ?

Thanks in advance.


How about the following?

listDt = Enumerable.Range(0,10).Select(Function(x) New DataTable()).ToList()


listDt = Enumerable.Range(0,10).Select(Function(x) templateDt.Clone).ToList()



As an alternate:
Enumerable.Repeat(new DataTable(), 10).toList


Hi @ppr ,

Enumerable.Repeat method duplicates its reference. So I suppose all items of the list points single datatable instance, don’t they?


1 Like

Thank you very much for this feedback. I did document and update the post

1 Like

After creating the Data table how can I assign it ? Do I need to create 10 variables with datatype data table ?

If possible can you please send me a screenshot of solution in UiPath.

Thanks in advance.