| 下面的代码是获取公司所有部门 存入list集合中,并返回此集合。         public IEnumerable<Department> ListAll()         {             List<Department> list = new List<Department>();             DataTable dt = SqlHelper.ExecuteDataTable("select * from T_Department where IsStopped=0");             foreach (DataRow row in dt.Rows)             {                 Department dept = ToModel(row);                 list.Add(dept);             }             return list;         } 不明白为什么返回值既然是List<Department> 。为什么方法的返回值是:IEnumerable<Department> 。而不是List<Department>呢?  他们有什么不同作用? 
 
 |