I was thinking about this for quite some time. Is function memoization really only for primitives?
I currently have this piece of code:
Public Shared Function Mize(Of TArg1 As Structure, TResult)(ByVal input_f As System.Func(Of TArg1, TResult)) As System.Func(Of TArg1, TResult) Dim map = New System.Collections.Generic.Dictionary(Of TArg1, TResult) Return Function(arg1 As TArg1) If map.ContainsKey(arg1) Then Return map.Item(arg1) Dim result = input_f(arg1) map.Add(arg1, result) Return result End Function End Function
And I'm wondering should i upgrade TArg1 such that it could accept any arbitrary class?