title: How can I use reflection to find the properties which implement a specific interface?
body: <p>Consider this example:</p>
  
  <pre><code>public interface IAnimal
  {
  }
  
  public class Cat: IAnimal
  {
  }
  
  public class DoStuff
  {
      private Object catList = new List&lt;Cat&gt;();
  
      public void Go()
      {
          // I want to do this, but using reflection instead:
          if (catList is IEnumerable&lt;IAnimal&gt;)
              MessageBox.Show("animal list found");
  
          // now to try and do the above using reflection...
          PropertyInfo[] properties = this.GetType().GetProperties();
          foreach (PropertyInfo property in properties)
          {
              //... what do I do here?
              // if (*something*)
                  MessageBox.Show("animal list found");
          }
      }
  }
  </code></pre>
  
  <p>Can you complete the if statement, replacing <em>something</em> with the correct code?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I noticed that I should have used a property instead of a field for this to work, so it should be:</p>
  
  <pre><code>    public Object catList
      {
          get
          {
            return new List&lt;Cat&gt;();
          }
      }
  </code></pre>