public class SyamilException : Exception
public SyamilException(String message)
public class AneeshException : Exception
public AneeshException(String message)
public class SreeragException : Exception
public SreeragException(String message)
{ Level2 L2=new Level2();
Console.WriteLine("Caught AneeshException from level2:{0}",e.Message);
throw new SreeragException("This is Sreerag Exception");
Console.WriteLine("Caught SyamilException from level3:{0}",e.Message);
throw new AneeshException("This is Aneesh Exception");
throw new SyamilException("This is Syamil Exception");
public static void Main(string[] args)
catch (SreeragException e) { Console.WriteLine("Caught SreeraException from level1:{0}",e.Message); }
Console.WriteLine("Rest of the Code");