title: How to dynamically create a object of a generic class?
body: <p>i have a sub with this signature</p>
  
  <pre><code>Public Sub Save(ByVal obj As IPta)
  </code></pre>
  
  <p>now i want the create a instance of Generic.PtaDao(of T) with the type of obj, which could be anything that inherits from my base class Pta</p>
  
  <p>how can i do that?
  i already found a c# example
  <a href="https://stackoverflow.com/questions/307984/declare-a-generic-type-instance-dynamically">Declare a generic type instance dynamically</a></p>
  
  <p>but i dont understand how to implement this in my case.</p>
  
  <p>tia</p>
  
  <p>-edit-</p>
  
  <p>to clearify</p>
  
  <p>lets pretend obj is a object of type Address (Address inherits from Pta so it implements IPta)</p>
  
  <p>now i want to create a new PtaDao object that takes Address objects for example</p>
  
  <pre><code>Dim AddressDao as New Generic.PtaDao(of Address)
  </code></pre>
  
  <p>but i want to do this dynamically so if obj is of type UserGroup it should create
  a PtaDao(of UserGroup)</p>