This is a one-line C# method that checks whether a string is a numerical value or not, by having regex (regular expressions) match a decimal with or without a floating point.
1. public static bool IsNumeric(string strToCheck)
2. {
3. return Regex.IsMatch(strToCheck,"^\\d+(\\.\\d+)?$");
4. }