file not found exception

Jan 7 2018 9:07 AM
try
{
string fileName= @"C:\Users\tnhfcl\Desktop\satya.txt ";
StreamReader streamreader = new StreamReader(fileName);
Console.WriteLine( streamreader.ReadToEnd());
Console.ReadLine();
streamreader.Close();
}
catch (FileNotFoundException ex)
{
Console.WriteLine(ex.FileName);
Console.ReadLine();
}

Answers (1)