public override CustomAction Do(CustomAction customAction) { CustomAction customAction1 = new CustomAction(() => { Console.WriteLine("另一个执行前的方法。"); customAction.Invoke(); }); return(customAction1); }
//展示 public void Show() { InvokeDelegate invokeDelegate = new InvokeDelegate(); Type type = typeof(InvokeDelegate); Type type1 = invokeDelegate.GetType(); MethodInfo method = type.GetMethod("Do"); CustomAction customAction = new CustomAction(() => { method.Invoke(invokeDelegate, null); }); if (method.IsDefined(typeof(AbstractAttribute), true)) { IEnumerable <AbstractAttribute> items = method.GetCustomAttributes <AbstractAttribute>(); foreach (var item in items.ToArray().Reverse()) { customAction = item.Do(customAction); } } customAction.Invoke(); }
public string Replace(string html) { return(CustomAction.Invoke(html)); }
public void Execute(object parameter) { CustomAction?.Invoke(parameter); }