日期:2014-05-18 浏览次数:21129 次
        /// <summary>
        /// 返回IList数据集
        /// </summary>
        /// <param name="startIndex">开始页数</param>
        /// <param name="endIndex">结束页数</param>
        /// <returns>实体类集合</returns>
        public IList<T> GetData(int startIndex, int endIndex)
        {
            this.startIndex = startIndex;
            this.endIndex = endIndex;
            SqlParameter[] parameters = SetParameter(false);
            IList<T> list = new List<T>();
            Type type = typeof(T);
            PropertyInfo[] properties = type.GetProperties();
            using (SqlDataReader sdr = SqlHelper.ExecuteReader(SqlHelper.connectionString, CommandType.StoredProcedure, "KFS_Pagination", parameters))
            {
                while (sdr.Read())
                {
                    T t = Activator.CreateInstance<T>();
                    for (int i = 0; i < properties.Length; i++)
                    {
                        properties[i].SetValue(t, sdr[i + 1], null);
                    }
                    list.Add(t);
                }
            }
            return list;
        }
------解决方案--------------------
            Type t = typeof(int);
            Console.WriteLine(t.FullName);
            Console.WriteLine(t.Assembly.FullName);