so im having a weird problem. when i make a linq query on a datatable I get
"Object reference not set to an instance of an object."
but when a use forloop on the result it works correctly.dt is a datatable
var productdata = from data in dt.AsEnumerable()
where data.Field<string>("Edited").ToString().ToUpper() == "NEW"
select data;//I get the object reference error here
foreach (var item in productdata) //but here the control goes inside the foreachloop even though the object refrence was null and the code gets executed correctly
{
//operation
}
only after the last iteraton does it give the null reference exception again. I dont understand why this is happening