Exemple #1
0
        /// <summary>
        /// 从hash表获取数据
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="key"></param>
        /// <param name="dataKeys"></param>
        /// <returns></returns>
        public Dictionary <string, string> HashGet(string key, List <string> dataKeys)
        {
            if (dataKeys != null && dataKeys.Count > 0)
            {
                dataKeys = dataKeys.Distinct().ToList();
                var values = QuickHelperBase.HashGet(key, dataKeys.ToArray()).ToList();

                Dictionary <string, string> dic = new Dictionary <string, string>();
                for (int i = 0; i < dataKeys.Count; i++)
                {
                    if (!dic.ContainsKey(dataKeys[i]) && values[i] != null)
                    {
                        dic.Add(dataKeys[i], values[i]);
                    }
                }

                return(dic);
            }

            return(QuickHelperBase.HashGetAll(key));
        }