c# 4.0 - How to create a Generic list parameter which will accept all the type of classes? -


public void generateexcelreport(list<eventhistory> lstdata)     {     } 

i using above list parameter (i.e. list of type "eventhistory" class) if want pass types of lists, how create list parameter generally?

you need add generic type parameter t method:

 void generateexcelreport<t>(list<t> list){  } 

then call it:

    generateexcelreport(stringlist);     generateexcelreport(objectlist); 

Comments