Does anyone know if it's possible to pass in a Class Type dynamically to a Class that requires Type TObject?
My controller Class is declared like this:
public class DataController<TObject> where TObject : class
I don't know what "TObject" will be at runtime in some circumstances, so I would like to know if there is a way of doing something like what I am trying below? By the time this code hits, I know the Type and it's stored in "t", which I am passing into this method thus:
private void RefreshGrid(Type t, DataGridView ctl)
{
DataController<t> cDataController = new DataController<t>();
//... other stuff
cDataController = null;
}
Obviously, the syntax here fails as "t" is a variable used like a type, the compiler rightly tells me.
Many thanks in advance.