I want to parse a string to float. And when the string is null it will pass 0 (as a float valule).
I was doing the parse like this :
aeVehicle.MSRP = float.Parse((drInvetory["MSRP"] ?? "0").ToString());
Which gave errors :
ERROR MESSAGE : Input string was not in a correct format.
ERROR SOURCE : at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseSingle(String value, NumberStyles options, NumberFormatInfo numfmt)
at System.Single.Parse(String s, NumberStyles style, NumberFormatInfo info)
at System.Single.Parse(String s)
Please suggest the best way to handle this situation.