Guest User

Untitled

a guest
Jan 24th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. private FileContent GetFileContent(string path)
  2. {
  3. FileContent f = null;
  4. try
  5. {
  6. XmlSerializer serializer = new XmlSerializer(typeof(FileContent));
  7. FileStream fileStream = new FileStream(path, FileMode.Open);
  8. f = (FileContent)serializer.Deserialize(fileStream);
  9. fileStream.Dispose();
  10.  
  11. }
  12. catch (Exception ex)
  13. {
  14. f = GetFileContent(path);
  15. }
  16. return f;
  17. }
Add Comment
Please, Sign In to add comment