how to know if all numbers are different C# code example
Example 1: c# how do you check if a string contains only digits
if (str.All(char.IsDigit)) {
Console.WriteLine("This string only contains numbers");
}
Example 2: c# check if string is all numbers
if (str.All(char.IsDigit)) {
// String only contains numbers
}