public override void Dispose() { _fileWriter?.Dispose(); _fileWriter = null; base.Dispose(); }
private static void Main() { var logger = new LogFileWriter("file.log"); logger.WriteToLog("Program has stated."); logger.WriteToLog("Somewhere in the middle."); logger.WriteToLog("Finish"); //throw new Exception(); logger.Dispose(); }