I have a generics problem that I hope someone can help with. I am looping through a list of properties of a generic object and I need to check if one of these properties is of type IEnumerable.
My code thus far:
var props = typeof(T).GetProperties();
foreach (var prop in props)
{
if(typeof(IEnumerable<>).IsAssignableFrom(prop.PropertyType))
System.Diagnostics.Debug.Write(prop.ToString());
}
So where I do the is assignable,I cannot get the correct type back, so I cannot compare.
Any ideas or recommendations?