Beispiel #1
0
        /// <summary>
        /// 按keys值排序,排除keys之外的
        /// </summary>
        public PayDictionary Sort(string[] keys)
        {
            List <string> listKeys = keys.ToList();
            PayDictionary pd       = new PayDictionary();

            foreach (string r in listKeys)
            {
                pd.Add(r, this[r]);
            }
            return(pd);
        }
Beispiel #2
0
        /// <summary>
        ///当前排序
        /// </summary>
        public void Sort(PaySortEnum pse)
        {
            List <string> listKeys = this.Keys.ToList();

            listKeys.Sort(new SortCamparer(pse));
            PayDictionary pd = new PayDictionary();

            foreach (string r in listKeys)
            {
                pd.Add(r, this[r]);
            }
            this.Clear();
            foreach (string r in listKeys)
            {
                this.Add(r, pd[r]);
            }
            pd.Clear();
            pd = null;
        }
Beispiel #3
0
        /// <summary>
        /// 转换 QueryString 参数值
        /// </summary>
        public static PayDictionary TransQueryString(string msg)
        {
            PayDictionary par = new PayDictionary();

            string[] split = msg.Split(new Char[] { '&' });
            for (int i = 0; i < split.Length; i++)
            {
                int pos = split[i].IndexOf('=');
                if (pos > 0)
                {
                    if (pos < split[i].Length - 1)
                    {
                        par.Add(split[i].Substring(0, pos), split[i].Substring(pos + 1));
                    }
                    else
                    {
                        par.Add(split[i].Substring(0, pos), "");
                    }
                }
            }
            return(par);
        }