29 lines
592 B
C#
29 lines
592 B
C#
using System;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Exceptionhandling
|
|
{
|
|
class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
|
|
try
|
|
{
|
|
using(var streamreader = new StreamReader(@"c:\file.zip"))
|
|
{
|
|
var content = streamreader.ReadToEnd();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine("Sorry, an unexpected error occured. :" + ex.Message);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|