Flashcards
C# evolution matrix

Cards in this deck (4)
- 1C# evolution Matrix

- 2What is the use of exceptions in C#?To handle errors in a graceful easy to use manner
- 3What are exceptions?Exceptions are unforeseen errors that happen in your programs. For example, you can’t predict when you’ll receive a file I/O error, run out of system memory, or encounter a database error. These things are generally unlikely, but they could still happen and you want to be able to deal with them when they do occur. This is where exception handling comes in.
Identifying the exceptions you’ll need to handle depends on the routine you’re writing. For example, if the routine opened a file with theSystem.IO.File.OpenRead() method, it could throw any of the following exceptions:
SecurityException
ArgumentException
ArgumentNullException
PathTooLongException
DirectoryNotFoundException
UnauthorizedAccessException
FileNotFoundException
NotSupportedException
It’s easy to find out what exceptions a method can raise by looking in the .NET Frameworks SDK Documentation. Just go to the Reference/Class Library section and look in the Namespace/Class/Method documentation for the methods you use. The exception in the list above were found by looking at the OpenRead() method definition of the File class - 4How do you handle exceptions in C#?by implementing a try/catch block. Code that could throw an exception is put in the try block and exception handling code goes in the catch block.
Information
- Description
- Flashcards on C# evolution matrix, created by Simi Sreedharan on 17/12/2016.
- Created by
- Simi Sreedharan
- Views
- 2
- Rating