Skip to content

Instantly share code, notes, and snippets.

@RickStrahl
RickStrahl / DebounceDispatcher.cs
Last active November 27, 2023 13:17
Debouncing events by a timeout using a Dispatcher.
public class DebounceDispatcher
{
private DispatcherTimer timer;
public void Debounce(int timeout, Action<object> action,
object param = null,
DispatcherPriority priority = DispatcherPriority.ApplicationIdle,
Dispatcher disp = null)
{
if (disp == null)