0

I am developing an Android (Mono) application. I have an SQLite database. I am trying to make a dynamic function to which I want to pass either a Type or a String as a parameter and then use that param to call the .CreateTable< Parameter (expects a Type, but you cannot use a variable in here, even if the passed parameter is of type "Type" >.

In other words I have different tables I need to create based on which table name is passed as a param for this function. Inside the function I call the sqlite.CreateTable function. I want this "Type" to be based on the param input of the main method.

Thank you

  • `Type.GetType(...)` maybe? – Biesi May 21 '18 at 14:12
  • well, this wouldn't work because I cannot pass variables or methods to the sqlite_connection.CreateTable<*no variables/methods*> function – Valentino Gechev May 21 '18 at 14:15
  • 1
    Oh I somehow missed that you were speaking about a generic method here... then https://stackoverflow.com/questions/3957817/calling-generic-method-with-type-variable might help you – Biesi May 21 '18 at 14:19
  • 1
    Post a portion of the code or pseudo code please. This can be resolved a few different ways that I can think of but I can't post a concrete answer without having something to go on. – Michael Puckett II May 21 '18 at 15:58

0 Answers0