public static void ReadTextFromFile(string filePath) { string stringFromFile = string.Empty; FileInfo file; try { file = new FileInfo(filePath); } catch (Exception ex) { UserInteraction.ErrorMsg(); UserInteraction.PrintExceptionInfo(ex); WriteLine(); return; } if (!file.Exists) { UserInteraction.ErrorMsg(); UserInteraction.FileNotExistsMsg(file.FullName); } else { try { using (StreamReader sr = new StreamReader(file.FullName)) { stringFromFile = sr.ReadToEnd(); } UserInteraction.SuccessMsg(); WriteLine("Text from file : "); WriteLine(stringFromFile); } catch (Exception ex) { UserInteraction.ErrorMsg(); UserInteraction.PrintExceptionInfo(ex); } } WriteLine(); }