IQueryable会将查询语法转化为SQL查询语句,去数据库查询;IEnumerable则查询整张表,加载到内存中,再进行筛选。
所以,当查询的数据量较大的时候,则使用IQueryable。反之,数据量较小,则使用IEnumerable,这样效率更高。