How to know if a PropertyInfo is a collection
if (typeof(IEnumerable).IsAssignableFrom(prop.PropertyType) && prop.PropertyType != typeof(string))
I agree with Fyodor Soikin but the fact that is Enumerable does not mean that is only a Collection since string is also Enumerable and returns the characters one by one...
So i suggest using
if (typeof(ICollection<>).IsAssignableFrom(pi.PropertyType))
Try
private bool IsEnumerable(PropertyInfo pi)
{
return pi.PropertyType.IsSubclassOf(typeof(IEnumerable));
}