title: C# Passing a class type as a parameter
body: <p>This for C#? 
  <a href="https://stackoverflow.com/q/8265241/684646">Passing Class type as a parameter</a> </p>
  
  <p>I have a class adapter that implements an Interface. I want to fill an array structure with MyFooClass instances where MyFooClass's name or reference I want to receive it from outside. I'll instantiate them inside my adapter code.</p>
  
  <p>For example:</p>
  
  <pre><code>    public void FillWsvcStructs(DataSet ds, ClassType Baz)
      {
          IFoo.Request = ds.DataTable[0].Request;
          IFoo.Modulebq = string.Empty;
          IFoo.Clasific = string.Empty;
          IFoo.Asignadoa = ds.DataTable[0].Referer;
          IFoo.Solicita = "Jean Paul Goitier";
  
  
          // Go with sub-Elems (Also "Interfaceated")
          foreach (DataSet.DataTableRow ar in ds.DataTable[1])
          {
              if ((int) ar.StatusOT != (int)Props.StatusOT.NotOT)
              {
                  ///From HERE!
                  IElemRequest req = new (Baz)(); // I don't know how to do it here
                  ///To HERE!
  
                  req.Id = string.Empty;
                  req.Type = string.Empty;
                  req.Num = string.Empty;
                  req.Message = string.Empty;
                  req.Trkorr = ar[1];
                  TRequest.Add(req);
              }
          }
      }
  </code></pre>