On Wed, Apr 27, 2011 at 6:10 PM, Steves <m...@stevesindelar.cz> wrote:
> but is there
> any way how I could implement my extension method?
You just have to memorize what arguments are used to instantiate the
generics instances, and apply them on top of the definitions.
You can write:
var list_int32_ref = (GenericInstanceType) myReference;
var int32_ref = genericInstance.GenericArguments [0];
var list_ref = genericInstance.ElementType;
var t = list_ref.GenericParameters [0];
Jb
On Thu, May 5, 2011 at 2:09 PM, Steves <m...@stevesindelar.cz> wrote:
> So far so good. However, dictPars contain generic parameters with
> names '!0' and '!1' instead of TKey and TValue,
> so I cannot map generic arguments of the Dictionary<string, T>
> reference, which are string and double (got from T -> double),
> to IDictionary<TKey, TValue>. Is this by design, or a bug?
This is by design, in the metadata, generic arguments for references
are only serialized by position, not by name.
> How can I
> get correct names of the
> generic parameters in this case?
You have to Resolve the ElementType to get the definition, which will
have the named generic parameters that you can address by position.
Jb