public static VectorA Parse(string text, IFormatProvider provider) { Regex r = new Regex(@"\((?<x>.*);(?<y>.*)\)", RegexOptions.None); Match m = r.Match(text); if (m.Success) { var result = new VectorA(); result.X = float.Parse(m.Groups["x"].Value, provider); result.Y = float.Parse(m.Groups["y"].Value, provider); return result; } throw new FormatException("String is not a valid VectorA."); }
public static VectorA Parse(string text, IFormatProvider provider) { Regex r = new Regex(@"\((?<x>.*);(?<y>.*)\)", RegexOptions.None); Match m = r.Match(text); if (m.Success) { var result = new VectorA(); result.X = float.Parse(m.Groups["x"].Value, provider); result.Y = float.Parse(m.Groups["y"].Value, provider); return(result); } throw new FormatException("String is not a valid VectorA."); }