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

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

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

            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;
        }
示例#3
0
        /// <summary>
        /// 转换 QueryString 参数值
        /// </summary>
        public static BaseDictionary TransQueryString(string msg)
        {
            BaseDictionary par = new BaseDictionary();

            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);
        }