June 2008
Intermediate to advanced
784 pages
20h 36m
English
System.Exception is the base exception class. All exceptions in .NET are derived from System.Exception. System.SystemException is the base class for system exceptions raised by the CLR, such as System.Data.DataException or System.FormatException. System.SystemException is derived directly from System.Exception. System.SystemException does not refine System.Exception. However, it is an important marker that distinguishes between system and application exceptions, as demonstrated in the following code:
using System; namespace Donis.CSharpBook { public class Starter { public static void Main() { try { int var1 = 5, var2 = 0; var1 /= var2; // exception occurs } catch(Exception except) { if (except is SystemException) { Console.WriteLine("Exception ...Read now
Unlock full access