using System.Collections;
public static void Main()
Console.WriteLine("\nException with some extra information...");
Console.WriteLine("\nException with all extra information...");
public static void RunTest(bool displayDetails)
NestedRoutine1(displayDetails);
Console.WriteLine("An exception was thrown.");
Console.WriteLine(e.Message);
Console.WriteLine(" Extra details:");
foreach (DictionaryEntry de in e.Data)
Console.WriteLine(" Key: {0,-20} Value: {1}",
"'" + de.Key.ToString() + "'", de.Value);
public static void NestedRoutine1(bool displayDetails)
NestedRoutine2(displayDetails);
e.Data["ExtraInfo"] = "Information from NestedRoutine1.";
e.Data.Add("MoreExtraInfo", "More information from NestedRoutine1.");
public static void NestedRoutine2(bool displayDetails)
Exception e = new Exception("This statement is the original exception message.");
string s = "Information from NestedRoutine2.";
DateTime dt = DateTime.Now;
e.Data.Add("stringInfo", s);
e.Data["DateTimeInfo"] = dt;