Skip to content

Instantly share code, notes, and snippets.

@TimMurphy
Created March 15, 2015 20:25
Show Gist options
  • Save TimMurphy/d6f74fdac670470f92d0 to your computer and use it in GitHub Desktop.
Save TimMurphy/d6f74fdac670470f92d0 to your computer and use it in GitHub Desktop.
var sb = new StringBuilder();
var properties = error.GetType().GetProperties();
foreach (var propertyInfo in properties)
{
sb.AppendLine(string.Format("public {0} {1} {{ get; set; }}", propertyInfo.PropertyType.Name, propertyInfo.Name));
}
foreach (var propertyInfo in properties)
{
sb.AppendLine(string.Format("{0} = error.{1};", propertyInfo.Name, propertyInfo.Name));
}
var format = sb.ToString();
LogTo.Info(format.Replace("{", "{{").Replace("}", "}}"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment