Encapsulating Action and Func?

前端 未结 4 1430
栀梦
栀梦 2021-02-08 09:46

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 10:00

    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);
        }
    }
    

提交回复
热议问题