- Create a text file and two folders to contain the log files. We will, however, only create a single log file in the BackupLog folder. Name your text file taskFile.txt and copy it to the BackupLog folder. The MainLog folder will remain empty:
- In our AsyncDemo class, write a method to read the log file in the folder specified by the enum value:
private async Task<int> ReadLog(LogType logType) { string logFilePath = String.Empty; if (logType == LogType.Main) logFilePath = @"C:\temp\Log\MainLog\taskFile.txt"; else if (logType == LogType.Backup) logFilePath = @"C:\temp\Log\BackupLog\taskFile.txt"; string enumName = Enum.GetName(typeof(LogType), ...