0

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 1

1

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();
Sign up to request clarification or add additional context in comments.

1 Comment

@sharmi You can accept the answer if it helped by clicking the 'tick' mark infront of the answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.