Assuming I have a table Entities with the columns Value and Type as varchar(strings) in a database, how would I go around to loading these values in C# and converting to the type specified in the table? I was intending to save the getType result for the Type value.
Assuming I have a table Entities with the columns Value and Type as varchar(strings)
Share
Save the
value.GetType().AssemblyQualifiedNamein theTypecolumn and then useType.GetType(asmQualfName)to get the type back when loading from the db. After that you can just useActivator.CreateInstanceto get an object of the correct type.