Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. static string ReadFile(string path)
  2.         {
  3.             string result = string.Empty;
  4.  
  5.             try
  6.             {
  7.                 if (path == "../../../ForFiltering.txt")
  8.                 {
  9.                     result = File.ReadAllText(path);
  10.                 }
  11.             }
  12.             catch (IOException)
  13.             {
  14.                 Console.WriteLine("Ошибка ввода и вывода!");
  15.             }
  16.             catch (System.Security.SecurityException)
  17.             {
  18.                 Console.WriteLine("Ошибка безопасности!");
  19.             }
  20.             catch (UnauthorizedAccessException)
  21.             {
  22.                 Console.WriteLine("Ошибка доступа к файлу!");
  23.             }
  24.             catch (Exception)
  25.             {
  26.                 Console.WriteLine("Ошибка программы!");
  27.             }
  28.  
  29.             return result;
  30.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement