I want to send different kinkds of lists by reference and receive as a gereral on the tools function. After that, do a downcasting and recuperate the original type. But it is not woking. Someone have the solution to make this work?
public Class A{
...
List<A> A_List= readAList();
saveToExcelTables(A_List,"A")
...
}
public Class B{
...
List<B> B_List= readBList();
saveToExcelTables(B_List,"B")
...
}
public Class Tools{
public static void saveTableToExcel(List<T> obj,string typeTyoe){
if(tableType == "A")
{
List<A> A_List= (A) obj;
}
if(tableType == "B")
{
List<B> B_List= (B) obj;
}
}