Handling of Null Values

c#, oracle

Solution

Try using `DBNull.Value` instead

if(obj != DBNull.Value)

Problem

I had an bizarre situation while debugging my code today. As the screen shot says, I had an `object obj` yields a value from an `System.Data.OracleClient` `ExecuteScalar()`. The yielded value was assigned to variable obj which clearly shows its a null, but the execution had gone inside a `if (obj != null)` statement which technically should not. Anything idea? I wonder I did the code correct?

Original source