public void TestParser() { string s0 = "(10,20)"; Size d0 = new Size(10, 20); Size d1 = (Size)_oc.Construct(s0); string s1 = _oc.Format(d1); Assert.Equal(d0, d1); Assert.Equal(s0, s1); }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { ObjectConverter dc = ObjectConverters.Find(targetType); if (dc != null && value is string s) { try { return(dc.Construct(s)); } catch (Exception e) { Debug.WriteLine("Unable to parse " + value.ToString() + ": " + e.Message); } } return(null); }