String - GetNumericValue

Converts the numeric Unicode character at the specified position in a specified string to a double-precision floating point number.

Try it

public static void Main()
{
    var myString = "EF6";

     // C# Extension Method: String - GetNumericValue
     var result = myString.GetNumericValue(2);

     Console.WriteLine(result);
}

View Source
using System;

public static partial class Extensions
{
    /// <summary>
    ///     Converts the numeric Unicode character at the specified position in a specified string to a double-precision
    ///     floating point number.
    /// </summary>
    /// <param name="s">A .</param>
    /// <param name="index">The character position in .</param>
    /// <returns>
    ///     The numeric value of the character at position  in  if that character represents a number; otherwise, -1.
    /// </returns>
    public static Double GetNumericValue(this String s, Int32 index)
    {
        return Char.GetNumericValue(s, index);
    }
}