c# check if there any number code example
Example 1: is number c#
var isNumeric = int.TryParse("123", out int n);
Example 2: c# check if string is all numbers
if (str.All(char.IsDigit)) {
// String only contains numbers
}
var isNumeric = int.TryParse("123", out int n);
if (str.All(char.IsDigit)) {
// String only contains numbers
}