O'Reilly logo

Head First C# by Jennifer Greene, Andrew Stellman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix A. Leftovers: The top 5 things we wanted to include in this book

image with no caption

The fun’s just beginning!

We’ve shown you a lot of great tools to build some really powerful software with C#. But there’s no way that we could include every single tool, technology, or technique in this book—there just aren’t enough pages. We had to make some really tough choices about what to include and what to leave out. Here are some of the topics that didn’t make the cut. But even though we couldn’t get to them, we still think that they’re important and useful, and we wanted to give you a small head start with them.

#1 LINQ to XML

XML—or Extensible Markup Language—is a format for files and data streams that represents complex data as text. The .NET framework gives you some really powerful tools for creating, loading and saving XML files. And once you’ve got your hands on XML data, you can use LINQ to query it. Add “using System.Xml.Linq;” to the top of a file and enter this method—it generates an XML document to store Starbuzz customer loyalty data.

private static XDocument GetStarbuzzData() {
    XDocument doc = new XDocument(
       new XDeclaration("1.0", "utf-8", "yes"),
       new XComment("Starbuzz Customer Loyalty Data"),
       new XElement("starbuzzData",
           new XAttribute("storeName", "Park Slope"),
           new XAttribute("location", "Brooklyn, NY"),
           new XElement("person", new XElement("personalInfo", new XElement("name", "Janet Venutian"), ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required