How can I determine if a property is a kind of array.
Example:
public bool IsPropertyAnArray(PropertyInfo property)
{
// return true if type is I
For me the following is not working,
return property.PropertyType.GetInterface(typeof(ICollection<>).FullName) != null;
Following was working,
typeof(ICollection<>).IsAssignableFrom(property.PropertyType.GetGenericTypeDefinition())
This is shortcut way to check ICollectionorICollection
var property = request as PropertyInfo;
property.PropertyType.IsGenericType && (typeof(ICollection<>).IsAssignableFrom(property.PropertyType.GetGenericTypeDefinition())) && typeof().IsAssignableFrom(property.PropertyType.GenericTypeArguments[0])