c# - System.Convert.ToSingle(value) always throws FormatException -
i have several strings
need convert float
. when try so, using system.convert.tosingle(mystring)
, formatexception
.
i have tried creating strings "12.123"
, make sure numbers okay, again got exception. question is, correct format then? in format should number in string be?
example of 1 of many strings convert: 50.105128
it down system's culture may set using ,
separator. setting format invariantculture
use .
separator.
convert.tosingle("12.123", cultureinfo.invariantculture)
Comments
Post a Comment