Skip to content

Commit 0e7f7a2

Browse files
author
ashongwe
committed
adding
1 parent fc07e85 commit 0e7f7a2

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

exception.cs

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System;
2+
using System.IO;
3+
4+
namespace ExceptionsTutorial
5+
{
6+
class Program
7+
{
8+
static void Main(string[] args)
9+
{
10+
try
11+
{
12+
StreamReader streamReader = new StreamReader(@"C:\Users\abel.shongwe\Desktop\content/seee.txt");
13+
Console.WriteLine(streamReader.ReadToEnd());
14+
streamReader.Close();
15+
}
16+
catch (FileNotFoundException e)
17+
{
18+
/*Console.WriteLine(e.FileName);
19+
Console.WriteLine(e.Message);
20+
Console.WriteLine();
21+
Console.WriteLine();
22+
Console.WriteLine(e.StackTrace);*/
23+
Console.WriteLine("Please Check if the file {0} exists",e.FileName);
24+
}
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)