IsNumeric function in c#

c#, function, numeric, parsing, try-catch

Solution

public bool IsNumeric(string value)
{
    return value.All(char.IsNumber);
}

Problem

I know it's possible to check whether the value of a text box or variable is numeric using try/catch statements, but `IsNumeric` is so much simpler. One of my current projects requires recovering values from text boxes. Unfortunately, it is written in C#. I understand that there's a way to enable the Visual Basic `IsNumeric` function in Visual C# by adding a reference to Visual Basic, though I don't know the syntax for it. What I need is a clear and concise walkthrough for enabling the `IsNumeric` function in C#. I don't plan on using any other functions indigenous to Visual Basic.

Original source

Related problems