public static bool TryDrawPolygon(this SciterGraphics graphics, Func <IEnumerable <PolygonPoint> > pointsFunc) { if (pointsFunc == null) { throw new ArgumentNullException(nameof(pointsFunc), @"Cannot be null."); } return(graphics?.TryDrawPolygon(points: pointsFunc.Invoke()) == true); }