Encapsulating Action and Func?

前端 未结 4 735
刺人心
刺人心 2021-02-08 06:03

I\'m trying to make a design for some sort of IExecutable interface. I will not get into details, but the point is that I have several Actions that need to be executed from a ba

4条回答
  •  爱一瞬间的悲伤
    2021-02-08 07:06

    what about something simple:

    public class ActionExecuter
    {
        private MulticastDelegate del;
        public ActionExecuter(MulticastDelegate del)
        {
            this.del = del;
        }
    
        public object Execute(params object[] p)
        {
            return del.DynamicInvoke(p);
        }
    }
    

提交回复
热议问题