Where Statement in Linq with nullable field
So you can't do this:
where e.myfield=myEnum.myvalue
or this
where e.myfield=1
when myfield is a nullable integer
In that situation you need to use .Equals
Like this:
where e.myfield.Value.Equals(myEnum.myvalue)
Voila!
where e.myfield=myEnum.myvalue
or this
where e.myfield=1
when myfield is a nullable integer
In that situation you need to use .Equals
Like this:
where e.myfield.Value.Equals(myEnum.myvalue)
Voila!
Comments