Item
select item.UnitPrice * item.OrderQuantity
).Sum();
textBox1.Text = total.ToString();
Notice that as you type, IntelliSense kicks in and displays the mapping between the XML and the XSD.
You know typed XML programming is here, and now you only need to type order.OrderDetail.
Now, compile and run the application, and click the Typed button. You will get the same results in the
text box that you did when you click the Untyped button.
Cool, huh? But wait. What is this Order object in the first line that the Load method uses? Where did that
come from? Put your mouse cursor over the word Order and right-click. From the context menu, select
Go To Definition (see Figure C-7).
352
Appendix C: LINQ to XSD
A file called LinqToXsdSources opens, as shown in Figure C-8.
This file is an external mapping file created by LINQ to XSD when the project is compiled. As you can
see, it is a fairly lengthy file, but it contains all the necessary mapping information to effectively provide
typed XML programming.
Figure C-7
Figure C-8
It is recommended that the generated code not be modified because it is quite complex and any changes
made to the file would be lost during regeneration.
Pages:
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544