Encapsulating Action and Func?

前端 未结 4 1995
轮回少年
轮回少年 2021-02-08 09:42

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:17

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

提交回复
热议问题