public ExceptionContainer(Exception e) { if (e == null) { return; } Exception = e; PropertyList = Exception.GetType().GetProperties() .ToDictionary( p => p.Name, p => Exception.GetType().GetProperty(p.Name)?.GetValue(Exception, null) ); InnerException = new ExceptionContainer(Exception.InnerException); }
//Test data for Designer public ExceptionContainer() { //#if TEST PropertyList = new Dictionary <string, object>(); PropertyList.Add("Property1", "Value"); PropertyList.Add("Property2", "Value"); PropertyList.Add("Property3", "Value"); PropertyList.Add("Property4", "Value"); InnerException = new ExceptionContainer(null); InnerException.PropertyList.Add("InnerException Property1", "Value"); InnerException.PropertyList.Add("InnerException Property2", "Value"); InnerException.PropertyList.Add("InnerException Property3", "Value"); InnerException.PropertyList.Add("InnerException Property4", "Value"); //#endif }