Example #1
0
 /// <summary>
 /// Reads from file
 /// </summary>
 /// <returns>List of read objects</returns>
 public List <T> Read()
 {
     if (!File.Exists(FilePath))
     {
         return(new List <T>());
     }
     if (!EnableCache)
     {
         return(_xmlSerializer.DeserializeFromXML <List <T> >(File.ReadAllText(FilePath)));
     }
     if (_data != null && lastModifiedTime == File.GetLastWriteTimeUtc(FilePath))
     {
         return(_data);
     }
     _data            = _xmlSerializer.DeserializeFromXML <List <T> >(File.ReadAllText(FilePath));
     lastModifiedTime = File.GetLastWriteTimeUtc(FilePath);
     return(_data);
 }