//use it like: string s=4.5; double d = s.ToDouble(); public static double ToDouble(this object source) { double val = 0; if (source != null) { string str = Convert.ToString(source); if (! string.IsNullOrEmpty(str)) { double.TryParse(str, out val); } } return val; }
No comments:
Post a Comment