//错误 5 无法将类型“WebProject.Model.LeftSecond”转换为“T” E:\WebProbject\DAL\LeftSecondDAL.cs 32 27 DAL接口using System;
using System.Collections.Generic;
using System.Text;
using WebProject.Model;namespace WebProject.DAL
{
    public interface IDAL<T>
    {
        /// <summary>
        /// 返回对象集合对象
        /// </summary>
        /// <returns>LeftFirst集合</returns>
        List<T> QueryAll();        /// <summary>
        /// 返回对象集合对象
        /// </summary>
        /// <param name="parentId">parentId</param>
        /// <returns>LeftSecond集合</returns>
        List<T> QueryById(string Id);
    }
}实现类:
using System;
using System.Collections.Generic;
using System.Text;
using WebProject.Model;
using System.Data.SqlClient;namespace WebProject.DAL
{
    public class LeftSecondDAL<T>:WebProject.DAL.IDAL<T>
    {
        #region IDAL<LeftSecond> 成员        public List<T> QueryAll()
        {
            return new List<T>();
        }        public List<T> QueryById(string Id)
        {
            string sql = "select * from LeftSecond where parentId=@parentId";
            SqlConnection con = DBUtil.SQLHelper.getConnection();
            SqlDataReader sdr = DBUtil.SQLHelper.Query(con, System.Data.CommandType.Text, sql, new SqlParameter[] { new SqlParameter("@parentId", Id) });
            List<T> nodes = new List<T>();
            LeftSecond node = null;
            while (sdr.Read())
            {
                node = new LeftSecond();
                node.ParentId = Convert.ToInt32(sdr["parentId"].ToString());
                node.Text = sdr["text"].ToString();
                node.Url = sdr["url"].ToString();
                node.Target = sdr["target"].ToString();
                nodes.Add((T)node);    //无法将类型“WebProject.Model.LeftSecond”转换为“T”
            }
            DBUtil.SQLHelper.CloseCon(con);
            return nodes;
        }        #endregion
    }
}