Hishop.Weixin.Pay/Util/PayDictionary.cs

(完整代码) 1KB

namespace Hishop.Weixin.Pay.Util
{
    using System;
    using System.Collections.Generic;

    internal class PayDictionary : Dictionary<string, string>
    {
        public void Add(string key, object value)
        {
            string str;
            if (value == null)
            {
                str = null;
            }
            else if (value is string)
            {
                str = (string) value;
            }
            else if (value is DateTime)
            {
                str = ((DateTime) value).ToString("yyyyMMddHHmmss");
            }
            else if (value is DateTime?)
            {
                DateTime? nullable = value as DateTime?;
                str = nullable.Value.ToString("yyyyMMddHHmmss");
            }
            else if (value is decimal)
            {
                str = string.Format("{0:F2}", value);
            }
            else if (value is decimal?)
            {
                decimal? nullable2 = value as decimal?;
                str = string.Format("{0:F0}", nullable2.Value);
            }
            else
            {
                str = value.ToString();
            }
            this.Add(key, str);
        }

        public void Add(string key, string value)
        {
            if (!(string.IsNullOrEmpty(key) || string.IsNullOrEmpty(value)))
            {
                base.Add(key, value);
            }
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。