Professional ASP.NET 3.5 in C# and Visual Basic Part 56

Professional in C# and Visual Basic Part 56. Building on the revolutionary release, adds several key new developer features including AJAX, LINQ, and a new CSS designer in Visual Web Developer 2008. The dramatic reduction in code that developers realized from the more than 50 new server controls in now allows developers the time to make their applications more interactive with AJAX, to work with data in their preferred language with LINQ, and to build visually attractive and consistent standards-based sites with CSS. . | Chapter 10 Working with XML and LINQ to XML Protected Sub Page_Load ByVal sender As Object ByVal e As _ Handles Dim bookcount As Integer 0 Dim settings As New XmlReaderSettings True True Dim booksFile As String Using reader As XmlReader booksFile settings While If _ And book Then bookcount 1 End If End While End Using Found 0 books bookcount End Sub End Class C using System using using public partial class _Default protected void Page_Load object sender EventArgs e int bookcount 0 XmlReaderSettings settings new XmlReaderSettings true true string booksFile using XmlReader reader booksFile settings while if book bookcount Found 0 books bookcount Notice the use of the method in Listing 10-5. You may be used to creating concrete implementations of an XmlReader but if you try this technique you should find it much more flexible 507 Chapter 10 Working with XML and LINQ to XML because you can reuse the XmlReaderSettings objects in the creation of other instances of XmlReader. XmlReader implements IDisposable so the Using keyword is correct in both VB and C . In Listing 9-5 the file is in the same directory as this ASPX page so a call to gets the complete path to the XML file. The filename with full path is then passed into along with the XmlReaderSettings instance from a few lines earlier. The Read method continues to return true if the node was read successfully. It will return false when no more nodes are left to read. From the point of view of an XmlReader everything is a node .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã 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.