I have a table storing datatypes of all the parameters and another table with the parameter values. When I use this in C# console app, how do I create a Type[] with the types present in the table?
1 Answer
Its not clear how you store the type in database. Assuming its the assembly qualified name (eg: System.String)
var types = new List<Type>();
foreach(var row in myTable.AsEnumerable())
{
var typeName = row.Field<string>("ColumnName");
types.Add(Type.GetType(typeName));
}
var array = types.ToArray();
1 Comment
Eranga
@sharmi You can accept the answer if it helped by clicking the 'tick' mark infront of the answer