using System.Collections.Generic;
using System.Threading.Tasks;
public static void Main(string[] args)
Console.WriteLine("Enter your file path: ");
string filepath = Console.ReadLine();
var textfile = System.IO.File.ReadAllLines(filepath);
Console.WriteLine("Line number:");
int num = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("\n" + textfile[num - 1]);
catch (IndexOutOfRangeException except)
Console.Error.WriteLine("IndexOutOfRangeException: The program cannot proceed");
Console.Error.WriteLine("Exception type: { 0}", except.Message);
catch (System.IO.FileNotFoundException except)
Console.WriteLine("FileNotFoundException: The program cannot proceed.");
Console.WriteLine("Exception type: { 0}", except.Message);
catch (UnauthorizedAccessException except)
Console.WriteLine("UnauthorizedAccessException: The program cannot proceed.");
Console.WriteLine("Exception type: { 0}", except.Message);
catch (System.IO.IOException except)
Console.WriteLine("IOException: The program cannot proceed.");
Console.WriteLine("Exception type: { 0}", except.Message);
catch (ArgumentException except)
Console.WriteLine("ArgumentException: The program cannot proceed.");
Console.WriteLine("Exception type: { 0}", except.Message);