Guest User

Untitled

a guest
Nov 22nd, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. public sealed class FileReader
  2. {
  3.  
  4. private static FileReader fileReader = null;
  5. private static List<Entry> lines = null;
  6. private FileReader(string fileName)
  7. {
  8. }
  9.  
  10. public static FileReader Instance
  11. {
  12. get
  13. {
  14. if (fileReader == null)
  15. {
  16. throw new Exception("Object not created");
  17. }
  18. return fileReader;
  19. }
  20. }
  21.  
  22. public static void Create(string fileName)
  23. {
  24. if (fileReader != null)
  25. {
  26. throw new Exception("Object already created");
  27. }
  28. lines = new List<Entry>();
  29. fileReader = new FileReader(fileName);
  30. }
  31. }
  32.  
  33. FileReader fr = FileReader.Instance;
  34.  
  35. FileReader fr = FileReader.Instance;
  36. fr.Create("test.txt");
Add Comment
Please, Sign In to add comment