public static string InvokeWithSummary(this MethodInfo method, object[] arguments) { Debug.Assert(method.IsStatic); var summary = new StringBuilder(); summary.AppendLine($"invoke '{method.GetFullName()}'"); summary.AppendLine("arguments:"); foreach (object arg in arguments) { summary.AppendLine($"\t{arg.About(1)}"); } if (method.ReturnType == typeof(void)) { method.Invoke(null, arguments); } else { object result = method.Invoke(null, arguments); summary.AppendLine($"result:\n\t{result.About()}"); } return(summary.ToString()); }