I have the following code:
if (intval == 0)
{
var result = (from dm in datacontext.Trk
where dm.ID == 0
select dm);
}
else
{
var result = (from dm in datacontext.Trk
where dm.ID != 0
select dm);
}
if (result != null)
{
// do something
}
There is a swigly line under the result in if (result!= null)
saying that the name result does not exist in the current context.
Not sure how to fix this. I tried to initially var result = null
but C# didn't like that.
how about something like this: