I have a generic Class
public class MyClass<T>
{
public List<T> Translate(List<T> list, params string[] names)
{
//do something here,modify list and return list
}
}
Now i can easily create its instances like
MyClass<Employee> obj= new MyClass<Employee>(); OR
MyClass<Vehicle> obj = new MyClass<Vehicle>();
I can call my method like
obj.Translate(Mylist of employee or vehicle type,"param1","param2")
But in my case i dont know the type T as its generated on runtime,see the code below
String classname = string.Empty;
if(Classtype == 1)
{
classname = "Employee"
}
else if(classtype == 2)
{
classname = "Vehicle"
}
I want something like below..so that i can creat an instance of this generic class
MyClass<typeof(classname)> empp = new MyClass<typeof(classname)>();
empp.Translate(MyList,"param1","param2")
Please suggest,how can i do that.