I'm working with the latest Mono.Cecil release, but I can't seem to
figure out how to extract a type parameter from an instantiation
generic type definition. Consider the following:

class Foo<T> {}

static void Bar<T>(T foo) where T : Foo<X>
{
}

I'm basically trying to inline any use of Foo<T>, so the constraint
T : Foo<X> would be simplified to just T : X. I've gotten a hold of
the type reference to Foo<X> in the generic parameter constraints of
Bar, but inspecting via reflection doesn't show any property that
returns the type X in Foo<X>.

I would have expected to find it in the GenericParameters collection
of Foo<X>, but that's empty. Is it perhaps because Cecil doesn't have
a reference to the assembly where X is defined?

I can parse out the inner type from the type name, but that's a bit of
a hack. Any clarification is much appreciated.

Sandro

-- 
--
mono-cecil

Reply via email to