title: c# Reflection - Find the Generic Type of a Collection
body: <p>I'm reflecting a property 'Blah' its Type is ICollection</p>
  
  <pre><code>    public ICollection&lt;string&gt; Blah { get; set; }
  
      private void button1_Click(object sender, RoutedEventArgs e)
      {
          var pi = GetType().GetProperty("Blah");
          MessageBox.Show(pi.PropertyType.ToString());
      }
  </code></pre>
  
  <p>This gives me (as you'd expect!) <code>ICollection&lt;string&gt;</code> ...</p>
  
  <p>But really I want to get the collection type i.e. <code>ICollection</code> (rather than <code>ICollection&lt;string&gt;</code>) - does anyone know how i'd do this please?</p>