How can I design a class to receive a delegate having an unknown number of parameters?

前端 未结 6 1165
耶瑟儿~
耶瑟儿~ 2020-12-10 19:55

I continuously find myself having to write timed windows services that poll outside queues or run timed processes. I consequently have a fairly robust template by which to

6条回答
  •  醉话见心
    2020-12-10 20:17

    You can use a delegate without parameters to represent the "service call":

    ThreadStart taskToPerform = delegate() { // do your stuff here
       YourService.Call(X, Y, Z);
    };
    Template.AddProcess(taskToPerform);
    

提交回复
热议问题