Handling Exceptions in C# Programs - Online Free Computer Tutorials.

'Software Development, Games Development, Mobile Development, iOS Development, Android Development, Window Phone Development. Dot Net, Window Services,WCF Services, Web Services, MVC, MySQL, SQL Server and Oracle Tutorials, Articles and their Resources

Monday, June 27, 2011

Handling Exceptions in C# Programs

After finishing the Part 1, let's create a program that will demonstrate the exception-handling capabilities of C#.    
This program will define an array that contains only one element.  
  
The program will then prompt the user to enter a 0 or a 1. If 0 is entered, program execution performs as expected and the element at an index of zero in the array will be displayed on screen. If 1 is entered, an exception will be thrown, as there is no corresponding index in the array. 

No comments:

Post a Comment