public bool AddVisitor(System.Type type, string[] args) { checkArg(type, "classname"); checkArg(args, "args"); MethodInfo m = type.GetMethod("visit", new System.Type[] { typeof(compilation), typeof(TextWriter), typeof(string[]), typeof(MessageWriter) }); if (m != null && m.IsStatic && m.IsPublic && m.ReturnType == typeof(compilation)) { VisitorDelegate visitor = (VisitorDelegate)VisitorDelegate.CreateDelegate(typeof(VisitorDelegate), m); return(AddVisitor(visitor, args)); } Console.WriteLine("Couldn't find visit method on {0}", type); return(false); }