public static WordInfo Parse ( [NotNull] JProperty property ) { Code.NotNull(property, "property"); string text = property.Name; string[] parts = text.Split('_'); if (parts.Length != 2) { throw new Exception(); } WordInfo result = new WordInfo { Word = parts[0], PartOfSpeech = parts[1], #if WINMOBILE || PocketPC Value = (float)NumericUtility.ParseDecimal(property.Value) #else Value = property.Value.ToObject <float>() #endif }; return(result); } #endregion #region Object members #endregion }
public void NumericUtility_ParseDecimal_1() { Assert.AreEqual(1.23m, NumericUtility.ParseDecimal("1.23")); Assert.AreEqual(1.23m, NumericUtility.ParseDecimal("1,23")); Assert.AreEqual(123.45m, NumericUtility.ParseDecimal("1,23.45")); }