title: Why does GetProperty fail to find it?
body: <p>I'm trying to use reflection to get a property from a class.  Here is some sample code of what I'm seeing:</p>
  
  <pre><code>
  using System.Reflection;
  namespace ConsoleApplication
  {
      class Program
      {
          static void Main(string[] args)
          {
              PropertyInfo[] tmp2 = typeof(TestClass).GetProperties();
              PropertyInfo test = typeof(TestClass).GetProperty(
                 "TestProp", BindingFlags.Public | BindingFlags.NonPublic);
          }
      }
  
      public class TestClass
      {
          public Int32 TestProp
          {
              get;
              set;
          }
      }
  }
  </code></pre>
  
  <p>When I trace through this, this is what I see:</p>
  
  <ul>
  <li>When I fetch all properties using <code>GetProperties()</code>, the resulting array has one entry, for property <code>TestProp</code>.</li>
  <li>When I try to fetch <code>TestProp</code> using <code>GetProperty()</code>, I get null back.</li>
  </ul>
  
  <p>I'm a little stumped; I haven't been able to find anything in the MSDN regarding <code>GetProperty()</code> to explain this result to me.  Any help?</p>
  
  <p>EDIT:</p>
  
  <p>If I add <code>BindingFlags.Instance</code> to the <code>GetProperties()</code> call, no properties are found, period. This is more consistent, and leads me to believe that <code>TestProp</code> is not considered an instance property for some reason.  </p>
  
  <p>Why would that be?  What do I need to do to the class for this property to be considered an instance property?</p>