Is there a similar way in C# to do the following:
class Memoize:
def __init__(self, f):
self.f = f
self.memo = {}
def __call__(self, *args):
if not args in self.memo:
self.memo[args] = self.f(*args)
return self.memo[args]
@Memoize
def fib(n):
if n < 2:
return n
else:
return fib(n-1) + fib(n-2)