(any == System.DBNull.Value) vs (any is System.DBNull)

.net, dbnull, null

Solution

if (any == System.DBNull.Value) ...

I prefer that one, simply because I read that as comparing values, not types.

Problem

Does any one have a preference on how to check if a value is `DBNull`? I've found these two statements give me the results I want, but just wondering if there's a preference? `if (any is System.DBNull)` same as: `if (any == System.DBNull.Value)` Thanks!

Original source

Related problems