Rest 不使用.ToList的数据也会发送到api,但如何发送呢?

Rest 不使用.ToList的数据也会发送到api,但如何发送呢?,rest,asp.net-web-api,webapi2,Rest,Asp.net Web Api,Webapi2,在web api中,不使用.ToList()的数据也会发送到api,但是如何发送呢? 这是我的LINQ查询,我不使用.ToList(),但我的数据也会发送到浏览器。有人能告诉我区别,或者描述一下它的工作原理吗 using (var _context = new iCMEFModelCon()) { return _context.UserResidents.Where(c => c.ResidentId == resi

在web api中,不使用
.ToList()
的数据也会发送到api,但是如何发送呢? 这是我的LINQ查询,我不使用
.ToList()
,但我的数据也会发送到浏览器。有人能告诉我区别,或者描述一下它的工作原理吗

using (var _context = new iCMEFModelCon())
                {
                    return _context.UserResidents.Where(c => c.ResidentId == residentId)
                        .Select(c => new
                        {
                            UserId = c.User.Id,
                            UserName = ((c.User.FirstName ?? "") + " " + (c.User.LastName ?? "")).Trim()
                        });
                }

查询的返回类型为IEnumerable或IQueryable:

Linq数据库查询的结果通常是
IQueryable
,它派生自
IEnumerable、IQueryable、
IEnumerable

如果数据源是
IEnumerable
,则结果类型为
IEnumerable