Don't use Parse. Use TryParse instead.
You can do this quiet easily. You just have to use the version of TryPrase that allows you to specify the FormatProvider, which describes how to parse the string into a Double. Read the documentation on Double for more information. It helps to create little test programs to try out something you're not sure of before dropping code into the app you're working on.
For example:
using System;
using System.Globalization;
namespace TryParse_Sandbox
{
class Program
{
static void Main(string[] args)
{
string[] input = { "2.8", "-2.8", "2.8-", "0", "-2", "2-" };
NumberStyles style = NumberStyles.AllowDecimalPoint |
NumberStyles.AllowLeadingSign |
NumberStyles.AllowTrailingSign |
NumberStyles.AllowThousands;
CultureInfo culture = CultureInfo.CurrentUICulture;
foreach (var number in input)
{
double value;
if (double.TryParse(number, style, culture, out value))
Console.WriteLine($"String: '{number}'\tParsed: {value}");
else
Console.WriteLine($"Failed to parse string: '{number}'");
}
}
}
}