Exemple #1
0
 public override bool AddRecord(DataRecord record)
 {
     if (xDocument == null)
     {
         return(false);
     }
     try
     {
         var            xElement = new XElement("record");
         Type           t        = record.GetType();
         PropertyInfo[] pi       = t.GetProperties();
         foreach (PropertyInfo p in pi)
         {
             xElement.Add(new XElement(p.Name, p.GetValue(record, null).ToString()));
         }
         xDocument.Root.Add(xElement);
         xDocument.Save(fileName);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }