Developer most of the time come across reusable codes. I have planned to collect all the reusable codes which come across my development experience and want to share with all.
This is one of the code which is always necessory
Introduction
IsNumebric
This method can be used in your application for checking the Numeric value.
public static bool IsNumeric( object expression )
{
// Variable to collect the Return value of the TryParse method.
bool isNumber;
// Define variable to collect out parameter of the TryParse method. If the conversion fails, the out parameter is zero.
double retNum;
// The TryParse method converts a string in a specified style and culture-specific format to its double-precision floating point number equivalent.
// The TryParse method does not generate an exception if the conversion fails. If the conversion passes, True is returned. If it does not, False is returned.
isNumber = Double.TryParse( Convert.ToString( expression ) , System.Globalization.NumberStyles.Any , System.Globalization.NumberFormatInfo.InvariantInfo , out retNum );
return isNumber;
}