I have a string "MyClass". Is there any way to initialize a generic object by string?
public void LoadToCache<T>(string key) where T : class, new()
{
//string key is a class name like "MyClass"
using (var bl = new BusinessLayer<key>())
{
bl.GetAll();
}
}
//---------------------------------------------------------------
public class BusinessLayer<T> where T : class
{
..
..
}
//---------------------------------------------------------------
public class MyClass
{
..
..
}