Contenu connexe
Similaire à Overview of CSharp MVC3 and EF4 (20)
Overview of CSharp MVC3 and EF4
- 1. AppSec (By Rich Helton) Moving to ASP MVC and Entity Frameworks (Rev 1) State of Colorado Office of Cyber Security
Notes de l'éditeur
- using System; using System.IO; using System.Text; class TestException{ static void Main(string[] args){ StreamReader myReader = null; try{ // constructor will throw FileNotFoundException myReader = new StreamReader("IamNotHere.txt"); }catch (FileNotFoundException e){ Console.WriteLine("FileNotFoundException was {0}", e.Message); }catch (IOException e){ Console.WriteLine("IOException was {0}" + e.Message); }finally{ if (myReader != null){ try{ myReader.Close(); }catch (IOException e){ Console.WriteLine("IOException was {0}" + e.Message); } } } } } Output-> FileNotFoundException was Could not find file ‘C:\\IamNotHere.txt'.