What you set with duck printing is easy typing, and .net is, at least, static typing, at least until version 3.5.
if you follow the path of these types, and if you want, enter the type of release: classical frameworks => prototyping frameworks => duck typing .
In js, obviously, you can achieve almost all of this, but in C # or vb.net you will find yourself in a classic and bureaucratic way when it comes to types.
You can freely create these types at runtime, but it consumes processing time, and while it is not in memory, it can be very slow.
If necessary, you have two ways (including reflection):
You can create these classes, which are likely to be the owner of the property using the property information, and then create the type and paste it into it. You will need to create a place to place, for example, an assembly or module. you will have little or no support from your current methods if you donβt think about an action plan for this and donβt worry about the security issues that it might involve.
You can follow the most painful path and use reflection.emit to create your type directly in the CLR, which can provide you with many, many benefits. It may turn out to be sick to do this though.
If you find a way, please, I would like to hear about it, because the duck printed it perfectly. Independent and courageous people must be valued.
Good luck to you
marcelo-ferraz
source share