Let\'s take Wes Dyer\'s approach to function memoization as the starting point:
public static Func Memoize(this Func f)
{
Did you read the comment from Dyer related to thread-safe in the article?
Probably the easiest way to make Memoize thread-safe is to put a lock on map.
This will ensure that the function that is being memoized will only be run once for each set of distinct arguments.
In my example of the RoboRally game, I actually used function memoization to act as "surrogate singleton". It isn't really a singleton since there can be one instance per factory instance (unless the factory is static). But that is exactly what I wanted.