title: Get type of property in generic method
body: <p>I have method:</p>
  
  <pre><code>static T RandomObject&lt;T&gt; (...) {
  var tmp = Activator.CreateInstance&lt;T&gt;();
  ...
     foreach (PropertyInfo info in tmp.GetType().GetProperties()){
     ...
     }
  }
  </code></pre>
  
  <p>And if class T have object properties I want to generate them random too, so what I do is:</p>
  
  <pre><code>var t = info.PropertyType;
  obj = RandomObject&lt;t&gt;(...);
  </code></pre>
  
  <p>And then I get:</p>
  
  <blockquote>
    <p>The type or namespace name t could not be found (are you missing a using directive or an assembly reference?)</p>
  </blockquote>
  
  <p>Any idea to solve this problem?</p>