更新时间:2022-10-21 21:32:58
The trouble with a method like that would be deciding what counts as "numeric". Should it allow decimals points, should it allow leading whitespace, should it have an upper bound for the number of digits?
Int32.TryParse answers the much more well-defined question of, "is this a valid string representation of an Int32?"
And of course, nothing is stopping you writing your own extension method, that decides if a string is numeric according to your own rules.