Exemplo n.º 1
0
        /// <summary>
        /// 获取所有的Key-Value形式的文本请求参数字典。
        /// </summary>
        /// <returns></returns>
        public virtual CDictionary GetParameters()
        {
            if (_parameters != null)
            {
                return(_parameters);
            }
            var properties = this.GetType().GetProperties().Where(m => m != null);
            //_parameters = properties.ToDictionary(m => m.Name, n => (object)HttpUtility.UrlEncode(n.GetValue(this, null).ToString()));
            IDictionary <string, string> paras = properties.ToDictionary(m => m.Name, n => Convert.ToString(n.GetValue(this, null)));

            _parameters = _parameters ?? new CDictionary();
            _parameters.AddAll(paras);
            return(_parameters);
        }