Using C# 4.0
features I want a generic wrapper for encapsulating functions and add a TimeOut
parameter to them.
For example we have a function like:
T DoLengthyOperation()
Using Func
we have:
Func<T>
This is good and call the function even Sync
(Invloke
) or Async
(BeginInvoke
).
Now think of a TimeOut
to be added to this behavior and if DoLengthyOperation()
returns in specified time we have true
returned, otherwise false
.
Something like:
FuncTimeOut<in T1, in T2, ..., out TResult, int timeOut, bool result>