ThrottleExtensions Class
Provides extension methods to throttle Action delegates so that they are invoked at most once per specified interval, regardless of how many times the returned delegate is called.
public static class ThrottleExtensionsMethods
| Name | Description |
|---|---|
| Throttle(Action, TimeSpan) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle(Action, TimeSpan, TimeProvider) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle(Action, TimeSpan, TimeProvider, Action<Exception>?) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0>(Action<T0>, TimeSpan) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0>(Action<T0>, TimeSpan, TimeProvider) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0>(Action<T0>, TimeSpan, TimeProvider, Action<Exception>?) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(Action<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>, TimeSpan) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(Action<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>, TimeSpan, TimeProvider) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(Action<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>, TimeSpan, TimeProvider, Action<Exception>?) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1>(Action<T0, T1>, TimeSpan) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1>(Action<T0, T1>, TimeSpan, TimeProvider) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1>(Action<T0, T1>, TimeSpan, TimeProvider, Action<Exception>?) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2>(Action<T0, T1, T2>, TimeSpan) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2>(Action<T0, T1, T2>, TimeSpan, TimeProvider) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2>(Action<T0, T1, T2>, TimeSpan, TimeProvider, Action<Exception>?) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3>(Action<T0, T1, T2, T3>, TimeSpan) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3>(Action<T0, T1, T2, T3>, TimeSpan, TimeProvider) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3>(Action<T0, T1, T2, T3>, TimeSpan, TimeProvider, Action<Exception>?) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3, T4>(Action<T0, T1, T2, T3, T4>, TimeSpan) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3, T4>(Action<T0, T1, T2, T3, T4>, TimeSpan, TimeProvider) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3, T4>(Action<T0, T1, T2, T3, T4>, TimeSpan, TimeProvider, Action<Exception>?) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3, T4, T5>(Action<T0, T1, T2, T3, T4, T5>, TimeSpan) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3, T4, T5>(Action<T0, T1, T2, T3, T4, T5>, TimeSpan, TimeProvider) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3, T4, T5>(Action<T0, T1, T2, T3, T4, T5>, TimeSpan, TimeProvider, Action<Exception>?) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3, T4, T5, T6>(Action<T0, T1, T2, T3, T4, T5, T6>, TimeSpan) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3, T4, T5, T6>(Action<T0, T1, T2, T3, T4, T5, T6>, TimeSpan, TimeProvider) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3, T4, T5, T6>(Action<T0, T1, T2, T3, T4, T5, T6>, TimeSpan, TimeProvider, Action<Exception>?) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3, T4, T5, T6, T7>(Action<T0, T1, T2, T3, T4, T5, T6, T7>, TimeSpan) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3, T4, T5, T6, T7>(Action<T0, T1, T2, T3, T4, T5, T6, T7>, TimeSpan, TimeProvider) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3, T4, T5, T6, T7>(Action<T0, T1, T2, T3, T4, T5, T6, T7>, TimeSpan, TimeProvider, Action<Exception>?) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3, T4, T5, T6, T7, T8>(Action<T0, T1, T2, T3, T4, T5, T6, T7, T8>, TimeSpan) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3, T4, T5, T6, T7, T8>(Action<T0, T1, T2, T3, T4, T5, T6, T7, T8>, TimeSpan, TimeProvider) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
| Throttle<T0, T1, T2, T3, T4, T5, T6, T7, T8>(Action<T0, T1, T2, T3, T4, T5, T6, T7, T8>, TimeSpan, TimeProvider, Action<Exception>?) | Wraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments. |
Throttle overloads
Throttle(Action, TimeSpan)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
Parameters
actionAction- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action.
Returns
Action A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle(Action, TimeSpan, TimeProvider)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action Throttle(this Action action, TimeSpan interval, TimeProvider timeProvider)Parameters
actionAction- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval.
Returns
Action A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle(Action, TimeSpan, TimeProvider, Action<Exception>?)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action Throttle(this Action action, TimeSpan interval, TimeProvider timeProvider, Action<Exception>? onError)Parameters
actionAction- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval. onErrorAction<Exception>?- Called with the exception thrown by
action. Whennull, the exception is unhandled and terminates the process, as for any timer callback. The throttle keeps working after the action throws.
Returns
Action A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Throttle<T0>(Action<T0>, TimeSpan)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
Type parameters
T0- The type of the parameter 0 of the action.
Parameters
actionAction<T0>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action.
Returns
Action<T0> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle<T0>(Action<T0>, TimeSpan, TimeProvider)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0> Throttle<T0>(this Action<T0> action, TimeSpan interval, TimeProvider timeProvider)Type parameters
T0- The type of the parameter 0 of the action.
Parameters
actionAction<T0>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval.
Returns
Action<T0> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle<T0>(Action<T0>, TimeSpan, TimeProvider, Action<Exception>?)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0> Throttle<T0>(this Action<T0> action, TimeSpan interval, TimeProvider timeProvider, Action<Exception>? onError)Type parameters
T0- The type of the parameter 0 of the action.
Parameters
actionAction<T0>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval. onErrorAction<Exception>?- Called with the exception thrown by
action. Whennull, the exception is unhandled and terminates the process, as for any timer callback. The throttle keeps working after the action throws.
Returns
Action<T0> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Throttle<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(Action<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>, TimeSpan)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> Throttle<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(this Action<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> action, TimeSpan interval)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
T4- The type of the parameter 4 of the action.
T5- The type of the parameter 5 of the action.
T6- The type of the parameter 6 of the action.
T7- The type of the parameter 7 of the action.
T8- The type of the parameter 8 of the action.
T9- The type of the parameter 9 of the action.
Parameters
actionAction<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action.
Returns
Action<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(Action<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>, TimeSpan, TimeProvider)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> Throttle<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(this Action<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> action, TimeSpan interval, TimeProvider timeProvider)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
T4- The type of the parameter 4 of the action.
T5- The type of the parameter 5 of the action.
T6- The type of the parameter 6 of the action.
T7- The type of the parameter 7 of the action.
T8- The type of the parameter 8 of the action.
T9- The type of the parameter 9 of the action.
Parameters
actionAction<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval.
Returns
Action<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(Action<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>, TimeSpan, TimeProvider, Action<Exception>?)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> Throttle<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(this Action<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> action, TimeSpan interval, TimeProvider timeProvider, Action<Exception>? onError)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
T4- The type of the parameter 4 of the action.
T5- The type of the parameter 5 of the action.
T6- The type of the parameter 6 of the action.
T7- The type of the parameter 7 of the action.
T8- The type of the parameter 8 of the action.
T9- The type of the parameter 9 of the action.
Parameters
actionAction<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval. onErrorAction<Exception>?- Called with the exception thrown by
action. Whennull, the exception is unhandled and terminates the process, as for any timer callback. The throttle keeps working after the action throws.
Returns
Action<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Throttle<T0, T1>(Action<T0, T1>, TimeSpan)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
Parameters
actionAction<T0, T1>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action.
Returns
Action<T0, T1> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle<T0, T1>(Action<T0, T1>, TimeSpan, TimeProvider)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1> Throttle<T0, T1>(this Action<T0, T1> action, TimeSpan interval, TimeProvider timeProvider)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
Parameters
actionAction<T0, T1>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval.
Returns
Action<T0, T1> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle<T0, T1>(Action<T0, T1>, TimeSpan, TimeProvider, Action<Exception>?)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1> Throttle<T0, T1>(this Action<T0, T1> action, TimeSpan interval, TimeProvider timeProvider, Action<Exception>? onError)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
Parameters
actionAction<T0, T1>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval. onErrorAction<Exception>?- Called with the exception thrown by
action. Whennull, the exception is unhandled and terminates the process, as for any timer callback. The throttle keeps working after the action throws.
Returns
Action<T0, T1> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Throttle<T0, T1, T2>(Action<T0, T1, T2>, TimeSpan)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2> Throttle<T0, T1, T2>(this Action<T0, T1, T2> action, TimeSpan interval)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
Parameters
actionAction<T0, T1, T2>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action.
Returns
Action<T0, T1, T2> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle<T0, T1, T2>(Action<T0, T1, T2>, TimeSpan, TimeProvider)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2> Throttle<T0, T1, T2>(this Action<T0, T1, T2> action, TimeSpan interval, TimeProvider timeProvider)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
Parameters
actionAction<T0, T1, T2>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval.
Returns
Action<T0, T1, T2> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle<T0, T1, T2>(Action<T0, T1, T2>, TimeSpan, TimeProvider, Action<Exception>?)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2> Throttle<T0, T1, T2>(this Action<T0, T1, T2> action, TimeSpan interval, TimeProvider timeProvider, Action<Exception>? onError)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
Parameters
actionAction<T0, T1, T2>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval. onErrorAction<Exception>?- Called with the exception thrown by
action. Whennull, the exception is unhandled and terminates the process, as for any timer callback. The throttle keeps working after the action throws.
Returns
Action<T0, T1, T2> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Throttle<T0, T1, T2, T3>(Action<T0, T1, T2, T3>, TimeSpan)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3> Throttle<T0, T1, T2, T3>(this Action<T0, T1, T2, T3> action, TimeSpan interval)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
Parameters
actionAction<T0, T1, T2, T3>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action.
Returns
Action<T0, T1, T2, T3> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle<T0, T1, T2, T3>(Action<T0, T1, T2, T3>, TimeSpan, TimeProvider)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3> Throttle<T0, T1, T2, T3>(this Action<T0, T1, T2, T3> action, TimeSpan interval, TimeProvider timeProvider)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
Parameters
actionAction<T0, T1, T2, T3>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval.
Returns
Action<T0, T1, T2, T3> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle<T0, T1, T2, T3>(Action<T0, T1, T2, T3>, TimeSpan, TimeProvider, Action<Exception>?)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3> Throttle<T0, T1, T2, T3>(this Action<T0, T1, T2, T3> action, TimeSpan interval, TimeProvider timeProvider, Action<Exception>? onError)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
Parameters
actionAction<T0, T1, T2, T3>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval. onErrorAction<Exception>?- Called with the exception thrown by
action. Whennull, the exception is unhandled and terminates the process, as for any timer callback. The throttle keeps working after the action throws.
Returns
Action<T0, T1, T2, T3> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Throttle<T0, T1, T2, T3, T4>(Action<T0, T1, T2, T3, T4>, TimeSpan)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3, T4> Throttle<T0, T1, T2, T3, T4>(this Action<T0, T1, T2, T3, T4> action, TimeSpan interval)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
T4- The type of the parameter 4 of the action.
Parameters
actionAction<T0, T1, T2, T3, T4>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action.
Returns
Action<T0, T1, T2, T3, T4> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle<T0, T1, T2, T3, T4>(Action<T0, T1, T2, T3, T4>, TimeSpan, TimeProvider)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3, T4> Throttle<T0, T1, T2, T3, T4>(this Action<T0, T1, T2, T3, T4> action, TimeSpan interval, TimeProvider timeProvider)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
T4- The type of the parameter 4 of the action.
Parameters
actionAction<T0, T1, T2, T3, T4>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval.
Returns
Action<T0, T1, T2, T3, T4> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle<T0, T1, T2, T3, T4>(Action<T0, T1, T2, T3, T4>, TimeSpan, TimeProvider, Action<Exception>?)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3, T4> Throttle<T0, T1, T2, T3, T4>(this Action<T0, T1, T2, T3, T4> action, TimeSpan interval, TimeProvider timeProvider, Action<Exception>? onError)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
T4- The type of the parameter 4 of the action.
Parameters
actionAction<T0, T1, T2, T3, T4>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval. onErrorAction<Exception>?- Called with the exception thrown by
action. Whennull, the exception is unhandled and terminates the process, as for any timer callback. The throttle keeps working after the action throws.
Returns
Action<T0, T1, T2, T3, T4> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Throttle<T0, T1, T2, T3, T4, T5>(Action<T0, T1, T2, T3, T4, T5>, TimeSpan)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3, T4, T5> Throttle<T0, T1, T2, T3, T4, T5>(this Action<T0, T1, T2, T3, T4, T5> action, TimeSpan interval)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
T4- The type of the parameter 4 of the action.
T5- The type of the parameter 5 of the action.
Parameters
actionAction<T0, T1, T2, T3, T4, T5>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action.
Returns
Action<T0, T1, T2, T3, T4, T5> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle<T0, T1, T2, T3, T4, T5>(Action<T0, T1, T2, T3, T4, T5>, TimeSpan, TimeProvider)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3, T4, T5> Throttle<T0, T1, T2, T3, T4, T5>(this Action<T0, T1, T2, T3, T4, T5> action, TimeSpan interval, TimeProvider timeProvider)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
T4- The type of the parameter 4 of the action.
T5- The type of the parameter 5 of the action.
Parameters
actionAction<T0, T1, T2, T3, T4, T5>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval.
Returns
Action<T0, T1, T2, T3, T4, T5> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle<T0, T1, T2, T3, T4, T5>(Action<T0, T1, T2, T3, T4, T5>, TimeSpan, TimeProvider, Action<Exception>?)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3, T4, T5> Throttle<T0, T1, T2, T3, T4, T5>(this Action<T0, T1, T2, T3, T4, T5> action, TimeSpan interval, TimeProvider timeProvider, Action<Exception>? onError)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
T4- The type of the parameter 4 of the action.
T5- The type of the parameter 5 of the action.
Parameters
actionAction<T0, T1, T2, T3, T4, T5>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval. onErrorAction<Exception>?- Called with the exception thrown by
action. Whennull, the exception is unhandled and terminates the process, as for any timer callback. The throttle keeps working after the action throws.
Returns
Action<T0, T1, T2, T3, T4, T5> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Throttle<T0, T1, T2, T3, T4, T5, T6>(Action<T0, T1, T2, T3, T4, T5, T6>, TimeSpan)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3, T4, T5, T6> Throttle<T0, T1, T2, T3, T4, T5, T6>(this Action<T0, T1, T2, T3, T4, T5, T6> action, TimeSpan interval)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
T4- The type of the parameter 4 of the action.
T5- The type of the parameter 5 of the action.
T6- The type of the parameter 6 of the action.
Parameters
actionAction<T0, T1, T2, T3, T4, T5, T6>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action.
Returns
Action<T0, T1, T2, T3, T4, T5, T6> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle<T0, T1, T2, T3, T4, T5, T6>(Action<T0, T1, T2, T3, T4, T5, T6>, TimeSpan, TimeProvider)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3, T4, T5, T6> Throttle<T0, T1, T2, T3, T4, T5, T6>(this Action<T0, T1, T2, T3, T4, T5, T6> action, TimeSpan interval, TimeProvider timeProvider)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
T4- The type of the parameter 4 of the action.
T5- The type of the parameter 5 of the action.
T6- The type of the parameter 6 of the action.
Parameters
actionAction<T0, T1, T2, T3, T4, T5, T6>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval.
Returns
Action<T0, T1, T2, T3, T4, T5, T6> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle<T0, T1, T2, T3, T4, T5, T6>(Action<T0, T1, T2, T3, T4, T5, T6>, TimeSpan, TimeProvider, Action<Exception>?)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3, T4, T5, T6> Throttle<T0, T1, T2, T3, T4, T5, T6>(this Action<T0, T1, T2, T3, T4, T5, T6> action, TimeSpan interval, TimeProvider timeProvider, Action<Exception>? onError)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
T4- The type of the parameter 4 of the action.
T5- The type of the parameter 5 of the action.
T6- The type of the parameter 6 of the action.
Parameters
actionAction<T0, T1, T2, T3, T4, T5, T6>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval. onErrorAction<Exception>?- Called with the exception thrown by
action. Whennull, the exception is unhandled and terminates the process, as for any timer callback. The throttle keeps working after the action throws.
Returns
Action<T0, T1, T2, T3, T4, T5, T6> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Throttle<T0, T1, T2, T3, T4, T5, T6, T7>(Action<T0, T1, T2, T3, T4, T5, T6, T7>, TimeSpan)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3, T4, T5, T6, T7> Throttle<T0, T1, T2, T3, T4, T5, T6, T7>(this Action<T0, T1, T2, T3, T4, T5, T6, T7> action, TimeSpan interval)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
T4- The type of the parameter 4 of the action.
T5- The type of the parameter 5 of the action.
T6- The type of the parameter 6 of the action.
T7- The type of the parameter 7 of the action.
Parameters
actionAction<T0, T1, T2, T3, T4, T5, T6, T7>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action.
Returns
Action<T0, T1, T2, T3, T4, T5, T6, T7> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle<T0, T1, T2, T3, T4, T5, T6, T7>(Action<T0, T1, T2, T3, T4, T5, T6, T7>, TimeSpan, TimeProvider)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3, T4, T5, T6, T7> Throttle<T0, T1, T2, T3, T4, T5, T6, T7>(this Action<T0, T1, T2, T3, T4, T5, T6, T7> action, TimeSpan interval, TimeProvider timeProvider)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
T4- The type of the parameter 4 of the action.
T5- The type of the parameter 5 of the action.
T6- The type of the parameter 6 of the action.
T7- The type of the parameter 7 of the action.
Parameters
actionAction<T0, T1, T2, T3, T4, T5, T6, T7>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval.
Returns
Action<T0, T1, T2, T3, T4, T5, T6, T7> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle<T0, T1, T2, T3, T4, T5, T6, T7>(Action<T0, T1, T2, T3, T4, T5, T6, T7>, TimeSpan, TimeProvider, Action<Exception>?)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3, T4, T5, T6, T7> Throttle<T0, T1, T2, T3, T4, T5, T6, T7>(this Action<T0, T1, T2, T3, T4, T5, T6, T7> action, TimeSpan interval, TimeProvider timeProvider, Action<Exception>? onError)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
T4- The type of the parameter 4 of the action.
T5- The type of the parameter 5 of the action.
T6- The type of the parameter 6 of the action.
T7- The type of the parameter 7 of the action.
Parameters
actionAction<T0, T1, T2, T3, T4, T5, T6, T7>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval. onErrorAction<Exception>?- Called with the exception thrown by
action. Whennull, the exception is unhandled and terminates the process, as for any timer callback. The throttle keeps working after the action throws.
Returns
Action<T0, T1, T2, T3, T4, T5, T6, T7> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Throttle<T0, T1, T2, T3, T4, T5, T6, T7, T8>(Action<T0, T1, T2, T3, T4, T5, T6, T7, T8>, TimeSpan)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3, T4, T5, T6, T7, T8> Throttle<T0, T1, T2, T3, T4, T5, T6, T7, T8>(this Action<T0, T1, T2, T3, T4, T5, T6, T7, T8> action, TimeSpan interval)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
T4- The type of the parameter 4 of the action.
T5- The type of the parameter 5 of the action.
T6- The type of the parameter 6 of the action.
T7- The type of the parameter 7 of the action.
T8- The type of the parameter 8 of the action.
Parameters
actionAction<T0, T1, T2, T3, T4, T5, T6, T7, T8>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action.
Returns
Action<T0, T1, T2, T3, T4, T5, T6, T7, T8> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle<T0, T1, T2, T3, T4, T5, T6, T7, T8>(Action<T0, T1, T2, T3, T4, T5, T6, T7, T8>, TimeSpan, TimeProvider)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3, T4, T5, T6, T7, T8> Throttle<T0, T1, T2, T3, T4, T5, T6, T7, T8>(this Action<T0, T1, T2, T3, T4, T5, T6, T7, T8> action, TimeSpan interval, TimeProvider timeProvider)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
T4- The type of the parameter 4 of the action.
T5- The type of the parameter 5 of the action.
T6- The type of the parameter 6 of the action.
T7- The type of the parameter 7 of the action.
T8- The type of the parameter 8 of the action.
Parameters
actionAction<T0, T1, T2, T3, T4, T5, T6, T7, T8>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval.
Returns
Action<T0, T1, T2, T3, T4, T5, T6, T7, T8> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.
Remarks
An exception thrown by action is unhandled and terminates the process, as for any timer callback. Use the overload that takes an error handler to handle it.
Throttle<T0, T1, T2, T3, T4, T5, T6, T7, T8>(Action<T0, T1, T2, T3, T4, T5, T6, T7, T8>, TimeSpan, TimeProvider, Action<Exception>?)
ThrottleExtensions.csWraps the specified action so that it is invoked at most once per interval. The first call schedules an invocation after the interval using the most recent arguments; calls made while an invocation is pending are ignored except for updating the arguments.
public static Action<T0, T1, T2, T3, T4, T5, T6, T7, T8> Throttle<T0, T1, T2, T3, T4, T5, T6, T7, T8>(this Action<T0, T1, T2, T3, T4, T5, T6, T7, T8> action, TimeSpan interval, TimeProvider timeProvider, Action<Exception>? onError)Type parameters
T0- The type of the parameter 0 of the action.
T1- The type of the parameter 1 of the action.
T2- The type of the parameter 2 of the action.
T3- The type of the parameter 3 of the action.
T4- The type of the parameter 4 of the action.
T5- The type of the parameter 5 of the action.
T6- The type of the parameter 6 of the action.
T7- The type of the parameter 7 of the action.
T8- The type of the parameter 8 of the action.
Parameters
actionAction<T0, T1, T2, T3, T4, T5, T6, T7, T8>- The action to throttle.
intervalTimeSpan- The minimum amount of time between invocations of
action. timeProviderTimeProvider- The
TimeProviderused to measure theinterval. onErrorAction<Exception>?- Called with the exception thrown by
action. Whennull, the exception is unhandled and terminates the process, as for any timer callback. The throttle keeps working after the action throws.
Returns
Action<T0, T1, T2, T3, T4, T5, T6, T7, T8> A throttled delegate that wraps action.
Exceptions
ArgumentNullExceptionactionortimeProviderisnull.