a
This commit is contained in:
@@ -44,6 +44,18 @@ namespace ExtensionMethods
|
||||
return result;
|
||||
}
|
||||
|
||||
public static double ToDouble(this object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return 0;
|
||||
var str = obj.ToString().Trim();
|
||||
|
||||
double result;
|
||||
double.TryParse(str, out result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static decimal ToDecimal(this string obj)
|
||||
{
|
||||
@@ -52,5 +64,13 @@ namespace ExtensionMethods
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static double ToDouble(this string obj)
|
||||
{
|
||||
double result;
|
||||
double.TryParse(obj.Trim(), out result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user