In the below example I have a method called GetList that takes a single string parameter and returns a List entities. I capture this in a generic IEnumerable variable because at runtime I have no idea what entity the user may want. How can I use the actual type instead of object?
I want to replace this...
IEnumerable<object> data = GetList(entityName);
With this...
IEnumerable<Company> data = GetList(entityName);
The only way I can think of handling it right now which I'm NOT going to do because we have 300+ entities is something like
switch(entitName)
{
case "Company":
IEnumerable<Company> data = GetList(entityName);
break;
case "Employee":
IEnumerable<Employee> data = GetList(entityName);
break;
...
}