[Solved] C# checking a whole char for numbers [closed]


I feel like taking risk to answer that but you can use Enumerable.All with char.IsDigit method and parse it to int like;

if(myString.All(char.IsDigit))
{
   return int.Parse(myString);
}

Or better, use int.TryParse to check your string is valid integer or not.

solved C# checking a whole char for numbers [closed]