Hey, On Sat, May 15, 2010 at 7:16 AM, Sandro <[email protected]> wrote: > 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>.
There is. Indeed, consider your previous. Foo<T> is the definition. It has one generic parameter. Bar<T> has a constraint of Foo<X>. Foo<X> is a generic instantiation. So the instance you're seeing is a: GenericInstanceType, with X in its GenericArguments collections. -- Jb Evain <[email protected]> -- -- mono-cecil
