public void Run(params object[] p)
{
TaskResult returns = ValidatePreconditions(p);
if (returns == TaskResult.ValidateTrue)
{
Type[] types = p.Select(param => param == null ? typeof(object) : param.GetType()).ToArray();
MethodInfo method = GetType().GetMethod("Init", types);
if (method == null && GetType().GetMethods().Any(m => m.Name == "Init"))
throw new InvalidOperationException(string.Format("Could not find any matching Init method on {0} with parameter types {1}",
GetType().Name,
string.Join(",", types.Select(t => t.Name))));
using (new TracingScope("Start " + GetType().Name))
{
if (method == null) { Start(p); } else { method.Invoke(this, p); }
}
}
}