-
Notifications
You must be signed in to change notification settings - Fork 10
Closed
Labels
questionA questionA question
Description
Hi,
I have a specific setup where I'm using Activator.CreateInstance.
Because I have a memory leak I want to try your approach.
But I'm not an expert so I want to ask you help to understand how to do it.
Here my current code
I have an array of class name like this one:
public static readonly string[] authTables = new string[]
{
typeof(User).FullName,
typeof(UserInfo).FullName
};
and I give it to my method (in tables):
public static void CreateTablesInDB(SqliteConnection con, string[] tables)
{
foreach (var table in tables)
{
Type tableType = Type.GetType(table + ", MyAssemblyName");//* assembly name
var instanceTable = Activator.CreateInstance(tableType);
// here do some stuff with my instanceTable....
string strCreateTable = ClassToDDL(instanceTable, "create");
}
}
User and UserInfo are my classes.
My question is: Can I use your approach? In which way?
Thank you.
Metadata
Metadata
Assignees
Labels
questionA questionA question