0

I have a property of type IEnumerable:

public class Model {
  public IEnumerable<Int32> values { get; set; }
}

On other class I have something like:

Type propertyType = context.getPropertyType["values"];

How can I check if propertyType is an IEnumerable and get its base type?

In this example the base type would be Int32.

Miguel Moura
  • 36,732
  • 85
  • 259
  • 481
  • 1
    https://stackoverflow.com/questions/28701867/checking-if-type-or-instance-implements-ienumerable-regardless-of-type-t and https://stackoverflow.com/questions/906499/getting-type-t-from-ienumerablet/17713382 – DavidG May 20 '19 at 12:32
  • 1
    https://stackoverflow.com/a/906513/4252588 – idubnori May 20 '19 at 12:33

0 Answers0