title: Why reflection does not find property
body: <p>I have the class:</p>
  
  <pre><code>    class Person 
      {
          public string Name { get { return "Antonio"; } }
      }
  </code></pre>
  
  <p>and the Code:</p>
  
  <pre><code>        IEnumerable&lt;object&gt; uncknownObject;
  
          uncknownObject = new ObservableCollection&lt;Person&gt;( );
  
          var observCol = uncknownObject.GetType( );
  
          var x = ( ( dynamic )observCol ).GenericTypeArguments[ 0 ];
  
          var y = observCol.GetProperty( "GenericTypeArguments" );
  
          var instance = ( Person )Activator.CreateInstance( x );
  
          Console.WriteLine( instance.Name ); // Print Antonio!!!
  </code></pre>
  
  <p>why does <code>y == null</code> ?</p>
  
  <p>Note the picture:</p>
  
  <p><img src="https://i.stack.imgur.com/S1M9l.png" alt="enter image description here"></p>
  
  <p>the debugger shows that the property <strong>GenericTypeArguments</strong> should exist and the code shows the opossite. It can be proven that the debugger is right and that property exist because then how come x is not null.  If that property exists then why <code>y</code> is equal to null!!!???</p>
  
  <hr>
  
  <h2>Edit</h2>
  
  <p>Thanks to Ani I now have:</p>
  
  <pre><code>        IEnumerable&lt;object&gt; uncknownObject;
  
          uncknownObject = new ObservableCollection&lt;Person&gt;();
  
          var observCol = uncknownObject.GetType();
  
          var genTypeArgsProperty = typeof(Type).GetProperty("UnderlyingSystemType");
  
          var genTypeArgsValue = (genTypeArgsProperty.GetValue(observCol, null));
  
          var f = genTypeArgsValue.GetType().GetMethod("GetGenericArguments");
  
          IEnumerable&lt;object&gt; result = (IEnumerable&lt;object&gt;)f.Invoke(genTypeArgsValue, null);
  
          var x = result.FirstOrDefault();
  
          var instance = Activator.CreateInstance(  (Type)x );
  </code></pre>
  
  <p><strong><a href="https://stackoverflow.com/questions/14639368/get-type-of-items-in-observablecollection">In case of curios why I needed that functionality click here</a></strong></p>