I\'d like to check if an object is a number so that .ToString() would result in a string containing digits and +,-,.
.ToString()
+
-
.
Assuming your input is a string...
There are 2 ways:
use Double.TryParse()
double temp; bool isNumber = Double.TryParse(input, out temp);
use Regex
bool isNumber = Regex.IsMatch(input,@"-?\d+(\.\d+)?");