Example #1
0
        /// <summary>
        /// 自定义反序列化小数(.NET Standard 2.1 可以自己重写 decimal.TryParse 处理)
        /// </summary>
        /// <param name="jsonDeSerializer"></param>
        /// <param name="buffer"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public virtual bool DeSerialize(JsonDeSerializer jsonDeSerializer, ReadOnlySpan <char> buffer, ref decimal value)
        {
            string stringBuffer = jsonDeSerializer.GetStringBuffer(buffer.Length);

            return(stringBuffer.Length != 0 && decimal.TryParse(stringBuffer, out value));
        }