I have an overloaded utility method called CheckDuration
with following function signatures.
private static Action<int> CheckDuration(Action action)
private static Action<int> CheckDuration<T>(Action<T> action, T arg)
Basically CheckDuration
prints on console how long it took to run a method.
Now, I would like to check the duration of a method that takes 2 argument.
So I would have to create another overloaded CheckDuration
with following method signature.
private static Action<int> CheckDuration<T, U>(
Action<T, U> action, T arg1, U arg2)
Is there a way to handle this more gracefully?
I was thinking about something like
private static Action<int> CheckDuration<params T>(
Action<params T> action, params T arg)
, which obviously doesn't work.
[UPDATE] I will leave this question open for now to see if anyone has come up with a work-around for this kind of problem.