suppose i have an Array of Datatables, for for each Datatable in that Array i am going to start a Thread to do some processing.
class someclass()
{
private DataTable[] DataTableArray;
someclass(DataTable sometable)
{
//divide sometable and distribute them to DataTableArray
}
private void startThreads()
{
for (int i = 0; i < DataTableArray.Count(); i++)
{
Task.Factory.StartNew(() => Downloader(DataTableArray[i]));
}
DataTableArray = null; //is this line necessary?
}
}
in my startThreads()
- after starting all threads can i set DataTableArray = null?
- i want to pass the Datatables by value, are they passed Default by value?, this is why i want to set it to null because that array is no longer needed