how to convert object instance to generic type?
<p>in a method i have an object like this:</p>

<pre><code>Activator.CreateInstance(Type.GetType(TargetObject))
</code></pre>

<p>and i need to pass this object to the other class that accept generic type:</p>

<pre><code>public class Repository&lt;T&gt; where T : class
{
}
</code></pre>

<p>how can i use this object as T to Repository class?</p>
