title: Non-static method requires a target in PropertyInfo.SetValue
body: <p>Ok, so I'm learning about generics and I'm trying to make this thing run, but its keep saying me the same error. Here's the code:</p>
  
  <pre><code>public static T Test&lt;T&gt;(MyClass myClass) where T : MyClass2
  {
      var result = default(T);
      var resultType = typeof(T);
      var fromClass = myClass.GetType();
      var toProperties = resultType.GetProperties();
  
      foreach (var propertyInfo in toProperties)
      {
          var fromProperty = fromClass.GetProperty(propertyInfo.Name);
          if (fromProperty != null)
              propertyInfo.SetValue(result, fromProperty, null );
      }
  
      return result;
  }
  </code></pre>