title: How do I find out whether an object's type is a subclass of IEnumerable<T> for any value type T?
body: <p>I need to validate an object to see whether it is null, a value type, or <code>IEnumerable&lt;T&gt;</code> where <code>T</code> is a value type.  So far I have:</p>
  
  <pre><code>if ((obj == null) ||
      (obj .GetType().IsValueType))
  {
      valid = true;
  }
  else if (obj.GetType().IsSubclassOf(typeof(IEnumerable&lt;&gt;)))
  {
       // TODO: check whether the generic parameter is a value type.
  }
  </code></pre>
  
  <p>So I've found that the object is null, a value type, or <code>IEnumerable&lt;T&gt;</code> for some <code>T</code>; how do I check whether that <code>T</code> is a value type?</p>