static string[] eTypes = { "none", "simple", "index", "nested index", "filter" };
static void ThrowException(string exceptionType)
Console.WriteLine($"ThrowException(\"{exceptionType}\") reached.");
Console.WriteLine("Not throwing an exception.");
Console.WriteLine("Throwing System.Exception.");
throw new System.Exception();
Console.WriteLine("Throwing System.IndexOutOfRangeException.");
Console.WriteLine("ThrowException(\"nested index\") " + "try block reached.");
Console.WriteLine("ThrowException(\"index\") called."); ThrowException("index");
Console.WriteLine("ThrowException(\"nested index\") general" + " catch block reached.");
Console.WriteLine("ThrowException(\"nested index\") finally" + " block reached.");
Console.WriteLine("ThrowException(\"filter\") " + "try block reached.");
Console.WriteLine("ThrowException(\"index\") called."); ThrowException("index");
Console.WriteLine("ThrowException(\"filter\") general" + " catch block reached.");
public static void Main()
foreach (string eType in eTypes)
Console.WriteLine("Main() try block reached.");
Console.WriteLine($"ThrowException(\"{eType}\") called.");
Console.WriteLine("Main() try block continues.");
catch (System.IndexOutOfRangeException e)
Console.WriteLine("Main() FILTERED System.IndexOutOfRangeException" + $"catch block reached. Message:\n\"{e.Message}\");
catch (System.IndexOutOfRangeException e)
Console.WriteLine("Main() System.IndexOutOfRangeException catch " + $"block reached. Message:\n\"{e.Message}\");
Console.WriteLine("Main() general catch block reached.");
Console.WriteLine("Main() finally block reached.");