i need to evaluate generic type at runtime using Type.GetType()
Type t = Type.GetType("className");
Table<t> table = dataContext.GetTable<t>();
any ideas please ??
i need to evaluate generic type at runtime using Type.GetType()
Type t = Type.GetType("className");
Table<t> table = dataContext.GetTable<t>();
any ideas please ??
Well, normally you need to get the generic method (e.g. with Type.GetMethod
), then call MethodInfo.MakeGenericMethod
, then invoke it.
However, is there any reason you don't just want to call DataContext.GetTable(Type)
?
You won't be able to use the table generically anyway... so is ITable
(the return type of GetTable(type)
) good enough for you?