Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public sealed class FileReader
- {
- private static FileReader fileReader = null;
- private static List<Entry> lines = null;
- private FileReader(string fileName)
- {
- }
- public static FileReader Instance
- {
- get
- {
- if (fileReader == null)
- {
- throw new Exception("Object not created");
- }
- return fileReader;
- }
- }
- public static void Create(string fileName)
- {
- if (fileReader != null)
- {
- throw new Exception("Object already created");
- }
- lines = new List<Entry>();
- fileReader = new FileReader(fileName);
- }
- }
- FileReader fr = FileReader.Instance;
- FileReader fr = FileReader.Instance;
- fr.Create("test.txt");
Add Comment
Please, Sign In to add comment