using System;
using System.IO;
public class Program
{
public static void Main()
StreamReader sr=null;
try{
sr= new StreamReader(@"Desktop\samplepk.txt");
Console.WriteLine(sr.ReadToEnd());
sr.Close();
}
catch(Exception)
Console.WriteLine("Please Check if file exists");
//Console.WriteLine(e.Message);
//Console.WriteLine("\n\n\n");
//Console.WriteLine(e.StackTrace);//stack trace will show the error line
finally//irrespective there is error or not finally block will get executed
if(sr!=null)
Console.WriteLine("Finally block executed and all resources are released");}