You have a string[][]:
string[][] myArray = new string[][] {};
You can either use one method for all tables, or define a separate method for each table.
Using one method for all tables, you define a list of tables
List<string> tables = new List<string> { "table1", "table2", "table3", "table4", "table5" };
Next, you use PLINQ to execute your method for each table in parallel:
tables.AsParallel().ForAll(table => DoSomethingWithTheArray(myArray, table));
...
private static void DoSomethingWithTheArray(string[][] myArray, string table)
{
switch (table)
{
case "table1":
break;
}
}
If you want to structure your code a bit better, and define a separate method for each table, you change the list of tables to be a list of methods:
List<Action<string[][]>> transformations = new List<Action<string[][]>>
{
TransformArrayForTableOne,
};
Then, change your PLINQ query to run all the methods in parallel:
transformations.AsParallel().ForAll(transformation => transformation(myArray));
...
private static void TransformArrayForTableOne(string[][] obj)
{
}
private static void TransformArrayForTableTwo(string[][] obj)
{
}
In each of the methods, you would perform the transformation to the specific DataRows. It's up to you how you want to commit these to the database.