Skip to content

Instantly share code, notes, and snippets.

@BoolPurist
Last active July 2, 2022 08:23
Show Gist options
  • Save BoolPurist/eb630dc5f490345e360d4721e7214a07 to your computer and use it in GitHub Desktop.
Save BoolPurist/eb630dc5f490345e360d4721e7214a07 to your computer and use it in GitHub Desktop.
How delegate work
delegate bool SomePredicate<T>(T a);
public List<T> Filter<T>(T[] input, SomePredicate<T> function)
{
var newList = new List<T>();
foreach(var element in input)
{
if (function(element))
{
newList.Add(element);
}
}
return newList;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment