I want to do do something like this :
Type t=typeof(int?);
or
Type t=typeof(MemoryStream);
However the parameter is string (“int?”,”MemoryStream”,etc) and it is not in assembly qualified type name so Type.GetType(string) won’t work.
The reason I need to get type is because I’m doing simple code generator application and it need to handle value & reference type different way, and also if type is Enumerable it will iterate and do specific operation.
Do you have any clue about this?
Well, you could create a compiler-on-the-fly, like so:
… but this is probably a really bad idea. You need a new in-memory assembly for each type you are testing. Some problems off the top of my head:
(I might actually downvote myself for suggesting this…) :^)
Is there any way to refactor the application to pass a Type? It’s going to make your life so much easier.