Consider this simplified example query:
dt = (
from O in ...
...
select new
{
O.A,
B = 0
}).ToList().ToDataTable()
Where .ToDataTable()
comes from Convert generic List/Enumerable to DataTable?
Assuming that table O
does not have an attribute called B
but I want to have a column called B
whose values I will fill in later. This works fine when B
get number values sent to it but i actually want to send it int?
values and at present it crashes if it gets send a null
.
Is there a way to select a new column (e.g. B
) such that it is a nullable type?