Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# HasValue vs !=null [duplicate]

Tags:

c#

null

My question might sound a little foolish but it bugs me every time i face it. What is the difference between :

where value.HasValue 

and

where value != null 

Does HasValue checks if value is null?

like image 624
oimitro Avatar asked Jul 22 '13 09:07

oimitro


1 Answers

They both do the same thing, just pick one and stick with it so that you have consistency. There is nothing to gain by using either in the end.

like image 53
Derek Avatar answered Sep 21 '22 11:09

Derek