Synae
Issue with dynamic
Hey there.
I'm having an issue and I can't figure out how to fix it.
There's this enum somewhere in another assembly, whose type is obfuscated and changes regularly:
I'm trying to use it with Reflection.
I retrieve the type by checking the first argument to a method in that same assembly that I know uses it.
That last line doesn't work because it complains that it cannot convert from
object
to Season
.
I cannot use the enum's type myself to cast it so I thought making myEnum
dynamic would work:
But it doesn't. An exception gets thrown at runtime that simply says:
System.TypeLoadException: Failure has occurred while loading a type.I tried many other variations, thinking that maybe I could help it understand what type it is better, to no avail. Is there anything I can do achieve what I want or fix that dynamic issue I'm having?
28 replies