title: C# - Class Type as Parameter in methods
body: <p>I'm using SQLite.cs wrapper for helping me with the database and  I have this method for create XML from a table, that is working fine.</p>
  
  <pre><code>public void GenerateInvoiceXML(string filePath) {
          var invoices = app.db.Table&lt;Invoice&gt;().ToList();
  
          XmlSerializer serializer = new XmlSerializer( typeof(List&lt;Invoice&gt;) );
          TextWriter writer = new StreamWriter(filePath);
  
          serializer.Serialize(writer,invoices);
          writer.Close();
  
  }
  </code></pre>
  
  <p>All tables that I have are defined like this:</p>
  
  <pre><code>[Serializable]  
  public class Invoice
  {
  
      [PrimaryKey, AutoIncrement]
      public int Id { get; set; }
      public string Supplier {get; set;}
      public string Date {get; set;}
      public string PaymentMethod {get; set;}
      public string Notes {get; set;}
  
      public Invoice(int newID)
      {
          Id = newID;
      }
      public  Invoice()
      {
  
      }
  }
  </code></pre>
  
  <p>But I want to change this method for something like this:</p>
  
  <pre><code>public void GenerateInvoiceXML(string filePath, Type table) {
          var dataForXML = app.db.Table&lt;table&gt;().ToList();
  
          XmlSerializer serializer = new XmlSerializer( typeof(List&lt;table&gt;) );
          TextWriter writer = new StreamWriter(filePath);
  
          serializer.Serialize(writer,dataForXML);
          writer.Close();     
  }
  </code></pre>
  
  <p>Does anybody have an idea how to do it?</p>
  
  <p>Kind Regards,<br>
  Claudio</p>