What is it that makes methods such as Select, Join, Where a Linq-to-Object's standard query operators and not...?
1) Internally, what is it 开发者_高级运维that makes methods such Select
, Join
, Where
etc ( besides the fact that query expressions get translated by compiler into these method calls ) a Linq-to-Object's standard query operators and not just regular methods that happen to operate on sequences of data?
Namelly, all the functionality offered by those operators could also be implemented in regular methods, but we don't call those regular methods standard query operators?!
2) Same question for Linq-to-XML methods – thus, what makes them query operators and not just regular methods that operate on XML data?
Thank you
Well they are "just regular (well, extension) methods" but they're also defined in the LINQ Standard Query Operators page on MSDN:
The standard query operators are the methods that form the Language-Integrated Query (LINQ) pattern. Most of these methods operate on sequences, where a sequence is an object whose type implements the IEnumerable interface or the IQueryable interface. The standard query operators provide query capabilities including filtering, projection, aggregation, sorting and more.
One interesting question is whether Zip
should count as a standard query operator, given that it was introduced in .NET 4...
精彩评论