标签:style blog color ar art div log new
Select 操作符对单个序列或集合中的值进行投影。
var query = contact .Where(c => c.FirstName.StartsWith("S")) .Select(c => new { c.FirstName, c.LastName, c.EmailAddress });
SelectMany 操作符提供了将多个 from 子句组合起来的功能,它将每个对象的结果合并成单个序列。
Names[] owners = { new Names { FirstName = "Scott, Chris", Pets = new List<string>{"Yukon", "Fido"}}, new Names { FirstName = "Jason, Steve", Pets = new List<string>{"Killer", "Fluffy"}}, new Names { FirstName = "John, Joe", Pets = new List<string>{"Spike", "Tinkerbell"}} }; IEnumerable<string> query = owners.AsQueryable() .SelectMany(owner => owner.Pets);
Select 与 SelectMany,布布扣,bubuko.com
标签:style blog color ar art div log new
原文地址:http://www.cnblogs.com/otfngo/p/3924646.html