Join Bruce Van Horn for an in-depth discussion in this video Handling exceptions with try-catch, part of C# Essential Training: 2 Flow Control, Arrays, and Exception Handling.
- [Narrator] Even in the most well planned,…well written and well executed software projects,…it is inevitable that runtime errors…are going to creep in at some point…so it makes good sense that as you're programing…you should just program in a defensive manner.…C Sharp has a facility for this for try catch.…So let me show you how this works,…one of the most common areas where your program…is going to run into runtime exceptions…is anytime when you have to deal with files.…
You don't have great control…over your end user's file system…and so if you are expecting a file to be present…and normally it is but some adventurous user…goes in and deletes it, then you need to plan…for things like that.…So let's create another method,…and I'll call this private static,…read text file.…And before I can actually read a text file…I need to add a using statement to the top of my class,…let me scroll up to the top here…and I'll just add using system dot IO.…
So those are going to be the classes involved…with input output, which is effectively…
AuthorBruce Van Horn
- Writing unit tests in C#
- Working with simple and multidimensional arrays
- Managing ordered and unordered data with lists
- Evaluating conditions with if-else statements
- Using OR, AND, and NOT operators
- Building loops
- Debugging and handling exceptions
- Creating the final build of your C# project
Skill Level Beginner
C# Object-Oriented Programming Tips and Trickswith Jesse Freeman58m 39s Intermediate
1. Unit Testing and Test-Driven Development
2. Arrays and Collections
3. Flow Control
4. Exception Handling
5. Getting to Production
Next steps1m 57s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.