c# check for a digit in a string code example Example: c# check if string is all numbers if (str.All(char.IsDigit)) { // String only contains numbers }