TAILIEUCHUNG - C# in Depth what you need to master c2 and 3 phần 9

Rõ ràng, trình biên dịch cần phải làm việc ra loại mảng để sử dụng. Nó bắt đầu bằng cách hình thành một tập hợp chứa tất cả các loại thời gian biên dịch của các biểu thức bên trong Ngầm gõ mảng C # 3 cho phép một cái gì đó ở giữa: | Groupings and continuations 307 In just five lines of code we have retrieved parsed and filtered a whole collection of log files returning a sequence of entries representing errors. Crucially we haven t had to load even a single full log file into memory all in one go let alone all of the files all the data is streamed. Having tackled joins the last items we need to look at are slightly easier to understand. We re going to look at grouping elements by a key and continuing a query expression after a group . by or select clause. Groupings and continuations One common requirement is to group a sequence of elements by one of its properties. LINQ makes this easy with the group . by clause. As well as describing this final type of clause we ll also revisit our earliest one select to see a feature called query continuations that can be applied to both groupings and projections. Let s start with a simple grouping. Grouping with the group . by clause Grouping is largely intuitive and LINQ makes it simple. To group a sequence in a query expression all you need to do is use the group . by clause with this syntax group projection by grouping This clause comes at the end of a query expression in the same way a select clause does. The similarities between these clauses don t end there the projection expression is the same kind of projection a select clause uses. The outcome is somewhat different however. The grouping expression determines what the sequence is grouped by the key of the grouping. The overall result is a sequence where each element is itself a sequence of projected elements and also has a Key property which is the key for that group this combination is encapsulated in the IGrouping TKey TElement interface which extendsIEnumerable TElement . Let s have a look at a simple example from the SkeetySoft defect system grouping defects by their current assignee. Listing does this with the simplest form of projection so that the resulting sequence has the

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.