any way to convert from DB.Null to decimal in C#
c#
Solution
How do you expect to cast `null` to anything? It's null, nothing, nada...
That said, your best bet would be to check for `DBNull` (or `null` in the above case) and use/return/whatever `default(decimal)` instead, though `null` and `DBNull` both have a significant semantic difference from just a default value; they are the absence of a value, so this is probably not what you want to do.
Problem
Is there any way to convert from DB.Null to decimal in C#? Like ``` Object[] returnvalue = new Object[1]; returnvalue[0] = null; returnvalue[0] = Convert.ToDecimal(returnvalue[returnvalue.Length - 1]); ``` Though CLR is saying that DBNull.Value cannot be type casted. Still I want to know is there any work around? Thanks in advance