Type t = Type.GetType("classname");
I got 't' like as class classname. I need like this.
List<t> list = db.Fetch<t>("select * from classname");
I get error:
"t" could not be found.
How can i use this?
Type t = Type.GetType("classname");
List<t> list = db.Fetch<t>("select * from classname");
that's the reason its not working
Your options, use:
db.Fetch<dynamic>("select * from classname");
which can be used to access all the properties of a given Type T
, only point is if a property doesn't exist then with dynamic type its a runtime exception not compile time error
If further required, you may use reflection to fill and object of Type T at run-time and where each property can be verified and filled and List can be created at run-time