I'm working on a project where I have to reflect through data models to find out what type is in each property on a data models. I have the code working for all cases except for generic collections. I have to be able to what T is in IList.
I have the following data model
public class ArrryOfObjects
{
public NestModelNestedClass NestClass { get; set; }
public int IntObject { get; set; }
public IList<NestModelNestedClass> ListOfObjects { get; set; }
}
I've seen a couple of examples, like https://stackoverflow.com/a/1043778/136717 on how to do this, but they use the type.GetGenericTypeDefinition()
to be get the type. But in my sample I cannot use this because 'type.IsGeneric.Parameter' is false.
I've review Type documentation and don't understand how to do this.