tags:

views:

499

answers:

3

How to read xml file from windows form application in c#? I am new in this .net framework prograaming. I have 3.5 .net framework please give simple program for it

+2  A: 

If you're using .Net 3.5 or later, you can use the XDocument class to read and write XML.

If you're still in .Net 2.0, you can use the XmlDocument class.

MusiGenesis
A: 

This link should help you.

DVK
+2  A: 

The simplest way to read an XML file into memory is to use the XDocument.Load method. This method takes a file path and returns an XDocument instance which can be used to query the contents

XDocument doc = XDocument.Load(@"c:\path\to\the\xmlfile.xml");

If you're working with an older API, you may need to use the XmlDocument class. It can be loaded in the following way

XmlDocument doc = new XmlDocument();
doc.Load(@"c:\path\to\the\xmlfile.xml");
JaredPar