Import namespace



I need to use CopytoDataTable method when I use the Datatable.Select and get the Array of datarows. But I dont see the methos appearing in Intellisense. I do not have the option of importing the namespace either which contains the CopytoDataTable() method


Hi Amrita,

System.Data.DataSetExtensions is not a namespace, but an assembly - methods from it are added to namespace System.Data.

Might be a coincidence, but when manually typing
DataTable newTable = myQuery.CopyToDataTable
(where myQuery is IEnumerable)
even though Intellisense doesn’t work for it, it added a reference to DataSetExtensions and the workflow works just fine.

You could check manually in a text editor if the xaml has the assembly reference to System.Data.DataSetExtensions.dll and if not, add it directly there.


I use return selectdatatable, Then I write selectdatatable.copytoDataTable,but

Hi Andrzej,

You are right, when I use the CopyToTable with a List it works perfectly fine without the INtellisense as well. But when I use it with as Array of DataRows(the result of using Datatable.Select()), it does not give me the datatable.

Could you please check if yours works with Array of DataRows as well?



Hi Amrita,

It does, once the DataSetExtensions.dll is referenced.
I’ve checked it step-by-step and the act of putting a variable of type IEnumerable<DataRow> as the rhand of the assign added the reference. After that I’ve deleted it and, since the ref is there, it works fine with DataRow[] as well (but still no Intellisense).

It gets more annoying when you try to use other methods from extensions, f.e. myDT.AsEnumerable().Where(... - if you get the syntax right it works, but doing method-syntax linq without intellisense is… suboptimal at best.