Forums - C# Corner

Forum guidelines
Pinpoint Solutions

Pinpoint Solutions

  • 1.3k
  • 11
  • 2.6k

How to dynamically cast a Table to a List

Dec 12 2012 3:15 AM

I have the following piece of code:

ITable tResults = myDataContext.GetTable(myObjectType); Type myListType = typeof(List<>).MakeGenericType(myObjectType);

So, I get the table data from object type which gives me a Linq.Table object (line 1).

Now, in line 2 I dynamically create a List where Type comes from the myObjectType Type variable.

my Question: How do I convert/cast my Linq.Table to a strongly typed List List ?

Answers (1)

Unlimited Flat-Free License


File APIs for .NET
Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!