Hi Serge,

The IL error you get is due to usage of !!0 outside of generic instantiation
context. You simply don't have type parameter #0 in this context.

Try the following:
   ldtoken    method void PreloadMethodInfo.Program::Generic<class .this>()

Thanks for your answer, it works. I can't say I understand why it
loads a runtime handle for the uninstantiated Generic<T> when I
specify the instantiated Generic<PreloadMethodInfo.Program>, but in
this sample, it does exactly what I need.

However, as I'm trying to generalize this code to loading a handle for
arbitrary generic methods, it's not always so simple. If there are
interface constraints on the method's type parameters, it's not as
easy to find a valid instantiation; "class .this" will not always
work.

If I understand correctly, I can only load handles to generic methods
of which I can name an instantiation at the time of token loading. Is
this correct, or is there another way?

Best regards,
Fabian

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to