private static void AddMemberParamPrompts(MethodInfo mem, DynamicPrompterCommand newcmd) { foreach (var par in mem.GetParameters()) { newcmd.Prompter.AddLast(new Prompts.PromptItem() { Prompt = par.Name, Validator = Validators.BaseValidator <string> .InstanceByType(par.ParameterType) }); } }
public ClassTemplate() { foreach (var item in Enum.GetNames(typeof(prompts))) { Add(item); } foreach (var mem in (from m in this.GetType().GetMethods(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.DeclaredOnly) where !m.Name.StartsWith("get_") select m)) { var newcmd = new Commands.DynamicPrompterCommand(mem, this); foreach (var par in mem.GetParameters()) { newcmd.Prompter.Add(new Prompts.PromptItem() { Prompt = par.Name, Validator = Validators.BaseValidator <string> .InstanceByType(par.ParameterType) }); } Add(mem.Name, ConsoleKey.D0 + this.Menu.MenuItems.Count, newcmd); } }