int myInt = 5; bool isNumeric = Type.IsNumericType(myInt.GetType()); // true
string myString = "123.45"; bool isNumeric = Type.IsNumericType(Type.GetTypeCode(myString.GetType())); // trueIn this example, we create a string variable that contains a number and use the GetTypeCode method to get the type code for the string's type, which is String. We then pass this type code to IsNumericType to check if it's a numeric type. Since the string contains a number, the method returns true. The package library for the System Type IsNumericType method is System.Reflection.