In my C# application (which uses C# 9) I had a line of code like this:
var filterCallback = new HitTestFilterCallback( el => el is Path s && s.Data