I have a method like this: (this is a generic method, and DYNAMIC_CLASS_TYPE
will be changed in situation to other situation)
Dim res = f.MyMethod(Of DYNAMIC_CLASS_TYPE)("select Id, Name from myTable")
I want to create a dynamic class, based on my query's columns and then pass the class instead of DYNAMIC_CLASS_TYPE
.
How can I do this?
I finally succeeded in doing it. My Code is as:
The return value of the function is a Type of my Custom Class.
There seems to be a bug. I think this line:
should look like this:
Regards.
A much simpler way is to use the System.Activator:
So say I have a class (Test) that takes a single string in the initialization
You could create a new instance like this:
This line:
must to be replaced with this: