I donβt know how to formulate this question without using an example, so here we go ...
I defined a class like this:
public class Orchestration<T1, T2, T3> {
Using this constructor:
public Orchestration(Action<T1, T2, T3> action, int maxNumberOfRetries)
And a method called Run:
public bool Run(T1 one, T2 two, T3 three)
Now if I do this:
var orchestration = new Orchestration<string, string, bool>(File.Copy, 5); orchestration.Run("c:\filename.txt", "d:\filename.txt", true)
then the orchestration will try to run File.Copy 5 times before it returns false, which means that the task failed (the background here is that I tried to save som files from a disk that was working just now, and then)
The Orchestration class is general, and I can use it to run any method that has three parameters.
My question is: Can I define an orchestration class so that the number of parameters is not predefined?
My goal then would be to let it run any method, not just methods that take three parameters ...
Petew source share