TAILIEUCHUNG - Apress pro LINQ Language Integrated Query in C# 2008 phần 3

LINQ hỗ trợ nhiều mô hình có thể mở rộng mà chúng dễ dàng cho việc tạo ra nhiều thao tác domain-specific hiệu quả cho những dữ liệu nguồn. Phiên bản "Orcas" của .NET Framework gắn với bulitates tạo ra rất nhiều các thư viện hữu ích cho phpes LINQ hỗ trợ ngược trở lại Objects, XML, and Databases. | 108 CHAPTER 4 DEFERRED OPERATORS In the preceding code notice I am enumerating through an outer sequence named outerSequence where each element is an object implementing IGrouping containing the key and a sequence of EmployeeOptionEntry elements having that same key. Here are the results Option records for employee 1 id 1 optionsCount 2 dateAwarded 12 31 1999 Option records for employee 2 id 2 optionsCount 10000 dateAwarded 6 30 1992 id 2 optionsCount 10000 dateAwarded 1 1 1994 id 2 optionsCount 10000 dateAwarded 4 1 2003 Option records for employee 3 id 3 optionsCount 5000 dateAwarded 9 30 1997 id 3 optionsCount 7500 dateAwarded 9 30 1998 id 3 optionsCount 7500 dateAwarded 9 30 1998 Option records for employee 4 id 4 optionsCount 1500 dateAwarded 12 31 1997 Option records for employee 101 id 101 optionsCount 2 dateAwarded 12 31 1998 For an example of the second GroupBy prototype let s assume I know that any employee whose id is less than 100 is considered a founder of the company. Those with an id of 100 or greater are not considered founders. My task is to list all option records grouped by the option record s employee founder status. All founders option records will be grouped together and all nonfounders option records will be grouped together. Now I need an equality comparer that can handle this key comparison for me. My equality comparer must implement the IEqualityComparer interface. Before examining my comparer let s take a look at the interface. The iIEqualityComparer T Interface interface IEqualityComparer T bool Equals T x T y int GetHashCode T x This interface requires me to implement two methods Equals and GetHashCode. The Equals method is passed two objects of the same type T and returns true if the two objects are considered to be equal or false otherwise. The GetHashCode method is passed a single object and returns a hash code of type int for that object. A hash code is a numerical value typically mathematically calculated based on some portion of .

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.