Visual Studio Toolbox: Using LINQ to XML to Write XML

Download this episode

Download Video


Previously on Visual Studio Toolbox, Robert showed how to use LINQ to XML to query data from Web sites. In this episode, Robert shows how to use LINQ to XML to write XML. He starts with a simple example that stores personal settings in an XML file, and then retrieves wines from and writes them to an XML file. This provides offline storage of the wines data. (You can think of this as the second half of his review of LINQ to XML, but last week's episode was a robust 40 minutes long while this one is a crisp 15. So it's really more like the last quarter Smiley)

Check out Robert's blog for all the code he used in this episode.



Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • User profile image

      Where's the C++ love ?

    • User profile image

      Please add a full screen option to the player!


    • User profile image

      Thanks! Great examples.

    • User profile image
      Amin Espinoza

      Is there a way I can "UPLOAD" an xml? I mean, in the first one, insert a new name without erasing the last one

    • User profile image

      Wrote the last post without signning in this way I can read the answer, thanks!!

    • User profile image

      @Indra: .. Its kinda pointless to argue about the superiority of manged versus native code .. the numbers speak for themselves .. but this time I can't resist ... Linq is a C# and VB thing .. its not native .. and as for C# vs C++ here's what the great Charles Petzold says ..   "I became a strong advocate of managed code, and I really haven't had any reason to return to the world of message loops and wayward memory pointers. I already paid my Windows API dues, and plenty of them."

    • User profile image

      Good stuff. I'm trying to convert a complex XSD schema to C# classes and vice versa. I've tried the XSD.exe, but get nesting errors ( most people seem to on the forums ). Is there a way to do this using what you demoed in this video or an updated XSD.exe tool ( free or commercial ) to do this?


    • User profile image

      I enjoyed this one.

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.