> One of the property of returnedObject is of the type List<MyClass> (in
> just one instance)
[quoted text clipped - 16 lines]
>
> how do i go about this..
Take pi.PropertyType, then:
o Check it's generic: type.IsGeneric
o Get the generic type: type.GetGenericType
o Check whether that generic type is List<>
o Fetch the generic type argument: type.GetGenericArguments
That's entirely untested, but I think it should work...

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
parez - 11 Mar 2008 22:28 GMT
> > One of the property of returnedObject is of the type List<MyClass> (in
> > just one instance)
[quoted text clipped - 29 lines]
> Jon Skeet - <sk...@pobox.com>http://www.pobox.com/~skeet Blog:http://www.msmvps.com/jon.skeet
> World class .NET training in the UK:http://iterativetraining.co.uk
Thanks..
This is what worked for me.
if (pi.PropertyType.IsGenericType)
{
if (pi.PropertyType.GetGenericTypeDefinition() ==
typeof(List<>))
{
// pi.PropertyType.GetGenericArguments() is
MyClass2, MyClass