Is there a general way to detect if a property's type is an enumerable type?
<p>Given this:</p>

<pre><code>class InvoiceHeader {
    public int InvoiceHeaderId { get; set; }
    IList&lt;InvoiceDetail&gt; LineItems { get; set; }
}
</code></pre>

<p>I'm currently using this code to detect if a class has a collection property:</p>

<pre><code>void DetectCollection(object modelSource)
{       
    Type modelSourceType = modelSource.GetType();
    foreach (PropertyInfo p in modelSourceType.GetProperties())
    {
        if (p.PropertyType.IsGenericType &amp;&amp;  p.PropertyType.GetGenericTypeDefinition() == typeof(IList&lt;&gt;))
        {
            System.Windows.Forms.MessageBox.Show(p.Name);
        }
    }
}
</code></pre>

<p>Is there a general way to detect if the LineItems is an enumerable type? Some will use other enumerable type (e.g. ICollection), not an IList.</p>
