title: loading multiple xml documents from folder
body: <p>started working on C# only a week ago. 
  developing an adapter/program to process xml documents from a folder and writing the output to an excel file.
  i am able to achieve the task -  used the xml, xml.linq classes.
   - now i have setout myself to automate the process. 
  (so that i can focus on the second part of my task, process a set of  .DAT files) </p>
  
  <p>in the above task i read each document at a time then "union" over similar type of xml's - (some of them are split over multiple files) then process them.</p>
  
  <p>What I would like to do with my program is as soon as the xml documents are transferred to a shared folder(windows) - i would like the program to start processing the xml files and write the output of the process to excel file.</p>
  
  <p>any pointers - as to what to look for would be of great help.</p>
  
  <pre><code>           ************************(update)[ratna:11th Aug 2011,6AM IST]
  
              **********************************sample code**************
  class FM
  {
  static void Main(string[] args)
           {
  
               FM LetsLoad = new FM();
               IEnumerable&lt;XElement&gt; loadedcustDoc = LetsLoad.LoadCustDocuments();
  
              Cust checkCustTrav = new Cust();
              checkCustTrav.CustTrav(loadedcustDoc);
              /*   to process the loaded documents and to output result to excel
              *
                        */
  
          //Console.ReadLine();
           }
  
          public IEnumerable&lt;XElement&gt; LoadCustDocuments()
          { 
              // Loading Customer **** Start***
              XDocument CustDoc1 = XDocument.Load(@"J:\dot\custtemp1.xml");
      XDocument CustDoc2 = XDocument.Load(@"J:\dot\custtemp2.xml");
  
  
              IEnumerable&lt;XElement&gt; CustEList1 = CustDoc1.Root.Descendants("Customer");
              IEnumerable&lt;XElement&gt; CustEList2 = CustDoc2.Root.Descendants("Customer");
              IEnumerable&lt;XElement&gt; CustEListComb = CustEList1.Union(CustEList2)
              return CustEListComb;
          }
   }  
  </code></pre>
  
  <p><em><strong></em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>*</strong><em>sample code end</em>****
  thank you all for the inputs provided.
  yes, I would like to watch the folder for documents added.
  once the documents are added, load the documents for processing.
  the processing  is handled by Cust class in this sample.
  the LoadCustDocuments is the method i would like to automate in order to read through all the XML's , and only load files with "cust" in file name, combine them with "Union" into one IEnumerable  and return for processing.[assuming this being the best way to do the load]</p>
  
  <p>I will be reading through the inputs provided, and post back.</p>