Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (239.79 KB, 15 trang )
© Copyright SELA Software & Education Labs Ltd. 14-18 Baruch Hirsch St. Bnei Brak 51202 Israel
LINQ via C# 3.0
Chapter 4 – LINQ to Objects
© Copyright SELA Software & Education Labs Ltd. 14-18 Baruch Hirsch St. Bnei Brak 51202 Israel
LINQ to Objects
•
Using language integrated query
operators with objects
•
Customizing query operators for particular
objects
•
Examples, examples, examples
© Copyright SELA Software & Education Labs Ltd. 14-18 Baruch Hirsch St. Bnei Brak 51202 Israel
LINQ to Objects
•
LINQ to Objects relies on the Enumerable
class, which contains query operators as
extension methods
•
Any IEnumerable<T> can be queried
•
Additional types can be queried if they
implement the query pattern
© Copyright SELA Software & Education Labs Ltd. 14-18 Baruch Hirsch St. Bnei Brak 51202 Israel
Query Pattern
•
If the type is not IEnumerable, there are
two ways to make it queryable:
–
Add instance methods for query operators: Select<T>,