tailieunhanh - Professional ASP.NET 3.5 in C# and Visual Basic Part 57

Professional in C# and Visual Basic Part 57. 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 ReadSubtree and XmlSerialization Not only does XmlReader help you retrieve simple types from XML it can help you retrieve more complicated types using XML serialization and ReadSubtree. XML serialization allows you to add attributes to an existing class that give hints to the XML serialization on how to represent an object as XML. XML serialization serializes only the public properties of an object not the private ones. When you create an XmlSerializer a Type object is passed into the constructor and the XmlSerializer uses reflection to examine whether the object can create a temporary assembly that knows how to read and write this particular object as XML. The XmlSerializer uses a concrete implementation of XmlReader internally to serialize these objects. Instead of retrieving the author s first name and last name using Listing 10-10 below uses ReadSubtree and a new strongly typed Author class that has been marked up with XML serialization attributes as shown in Listing 10-9. ReadSubtree breaks off a new XmlReader at the current location and that XmlReader is passed to an XmlSerializer and a complex type is created. The Author class includes XmlElement attributes that indicate for example that although there is a property called FirstName it should be serialized and deserialized as first-name. Listing 10-9 An Author class with XML serialization attributes matching VB Imports XmlRoot ElementName author _ Namespace http Public Class Author XmlElement ElementName first-name Public FirstName As String XmlElement ElementName last-name Public LastName As String End Class C using XmlRoot ElementName author Namespace http public class Author XmlElement ElementName first-name public string FirstName XmlElement ElementName last-name public string LastName Next this Author class is used along with .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã 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.