public static List<T> GetColumnValuesByHeader<T>(string docName)
{
// How can i get T as Customer or Employee in here?
}
List<Customer> customers = GetColumnValuesByHeader<Customer>("Customers.dat")
List<Employee> employees= GetColumnValuesByHeader<Employee>("Employees.dat")
public static List<T> GetColumnValuesByHeader<T>(string docName) { // How can i get T as Customer
Share
As Jon Skeet said you can use typeof to get the type of T. You can also use the Activator class to create an instance of that class.