First of all: You should work on data, not on string!
What it means?
Note: student data should be stored in a
List<Student>
instead of
List<string>
! You have to pass it into your method to bulk copy data.
Second of all: ListToDataTable
class should be static and its method
ToDataTable
too!
public static class ListToDataTable
{
public static DataTable ToDataTable<T>(List<T> items)
{
}
}
Third of all: If you would like to use async method, you'll need to create async method, which accept list of students converted into datatable. More at:
c# - Async for Bulk copy - Stack Overflow[
^]