Try, Catch and Finally
Build error – the compiler tells you what line contains a build error and provides useful information
Runtime error – this type can crash your application if not properly handled.
Visual C# supports structured exception handling
Block Types for error handling
Try – block where the error can occurs
Catch – block where you handle the exception
Finally – block that will be execute after try or catch block will be complete.
Try forms:
- try + one or more catch
- try + finally – if you omit the catch session, the error will be ignored (= “On error resume next”?)
- try + one or more catch + finally.
Exception object - represents errors that occur during application execution.
System.Diagnostics – this namespace provides classes that allow you to interact with system processes, event logs and performance counters. Event log, Process and Performance counter are classes from it.
It also provides classes that allow you to debug your application and trace the execution of your code. See Trace and Debug Classes.
No comments:
Post a Comment