private bool TaskContainsMethod(string methodName, Task task)
        {
            if (task == null)
            {
                return(false);
            }
            MethodInfo method = ((object)task).GetType().GetMethod(methodName, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

            if (method != (MethodInfo)null && method.DeclaringType.IsAssignableFrom(((object)task).GetType()))
            {
                return(true);
            }
            if (task is ParentTask)
            {
                ParentTask parentTask = task as ParentTask;
                if (parentTask.get_Children() != null)
                {
                    for (int index = 0; index < parentTask.get_Children().Count; ++index)
                    {
                        if (this.TaskContainsMethod(methodName, parentTask.get_Children()[index]))
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }