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

Visual Studio "Orcas" gắn một LINQ tới trình thiết kế SQL mà nó cung cấp một phương pháp dễ dàng để tạo mẫu và hình dung một csdl như là một LINQ tới mô hình đối tượng SQL. Sử dụng LINQ tới trình thiết kế SQL bạn có thể dễ dàng tạo ra một sự miêu tả của ví dụ về csdl "Northwind" như bên dưới | CHAPTER 8 LINQ TO XML OPERATORS 275 new XElement BookParticipant new XAttribute type Editor new XElement FirstName Ewan new XElement LastName Buckingham IEnumerable XElement elements BookParticipants .Descendants FirstName First I will display the source elements. foreach XElement element in elements Source element 0 value 1 Now I will display the ancestor elements for each source element. foreach XElement element in Ancestor element 0 In the previous example first I create an XML document. Next I generate a sequence of FirstName elements. Remember this Ancestors method is called on a sequence of nodes not on a single node so I need a sequence on which to call it. Because I want to be able to display the names of the nodes for identification purposes I actually build a sequence of elements because elements have names but nodes do not. I then enumerate through the sequence displaying the source elements just so you can see the source sequence. Then I enumerate on the elements returned from the Ancestors method and display them. Here are the results Source element FirstName value Joe Source element FirstName value Ewan Ancestor element BookParticipant Ancestor element BookParticipants Ancestor element BookParticipant Ancestor element BookParticipants As you can see it displays the two source sequence elements the two FirstName elements. It then displays the ancestors for each of those two elements. So using the Ancestors operator I am able to retrieve all of the ancestor elements for each node in a sequence of nodes. In this case my sequence is a sequence of elements but that is alright because an element is derived from a node. Remember do not confuse the Ancestors operator that is called on a sequence of nodes which I just demonstrated with the Ancestors method I cover in the previous chapter. Now this example is not quite as impressive as it could be .

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.