Skip to content

Instantly share code, notes, and snippets.

@neuecc
Created June 3, 2021 16:09
Show Gist options
  • Save neuecc/845bd3da885546c200ddacebeb37883d to your computer and use it in GitHub Desktop.
Save neuecc/845bd3da885546c200ddacebeb37883d to your computer and use it in GitHub Desktop.
// don't send same value(Rx's DistinctUntilChanged) by Filter
public class ChangedValueFilter<T> : MessageHandlerFilter<T>
{
T lastValue;
public override void Handle(T message, Action<T> next)
{
if (EqualityComparer<T>.Default.Equals(message, lastValue))
{
return;
}
lastValue = message;
next(message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment