Skip to main content

Practice · 2 of 3

Delegate composition pipeline

CHALLENGE
Difficulty: advanced+25 XP

Implement static Func<string, string> Pipeline(params Func<string, string>[] steps) returning one delegate applying steps left to right (step 1 first). Also implement static Func<int> Memoize(Func<int> f) — no, simpler: implement static int InvokeThrice(Func<int> f) that calls f exactly three times and returns the last result (tests that delegates are first-class values).

Back to lesson: Practice: Delegate drills