13.07.2015 Views

Applied XML Programming for Microsoft .NET.pdf - Csbdu.in

Applied XML Programming for Microsoft .NET.pdf - Csbdu.in

Applied XML Programming for Microsoft .NET.pdf - Csbdu.in

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Order ord1 = new Order();ord1.ID = 98;ord1.Date = new DateTime(2002,7,4);ord1.Total = 145.90;emp.Orders.Add(ord1);Order ord2 = new Order();ord2.ID = 101;ord2.Date = new DateTime(2002,7,24);ord2.Total = 2000.00;emp.Orders.Add(ord2);After <strong>in</strong>itializ<strong>in</strong>g the members as shown <strong>in</strong> the preced<strong>in</strong>g code, the f<strong>in</strong>al output looks likethis:...1232002-08-12T00:00:00.0000000+02:001245.23982002-07-04T00:00:00.0000000+02:00145.91012002-07-24T00:00:00.0000000+02:002000As you can see, the <strong>XML</strong> code be<strong>in</strong>g generated conta<strong>in</strong>s very little type <strong>in</strong><strong>for</strong>mation.This is not a specific feature of <strong>XML</strong> serialization, however. The run-time objectserialization process also considers type <strong>in</strong><strong>for</strong>mation optional—at least <strong>in</strong> most cases.This standpo<strong>in</strong>t is quite reasonable. Serialization is just a way to persist the state of anobject. Dur<strong>in</strong>g deserialization, an <strong>in</strong>stance of the object will be created from the401

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!