-
Notifications
You must be signed in to change notification settings - Fork 35
M_CodeJam_Algorithms_Memoize__8
Andrew Koryavchenko edited this page Jul 4, 2017
·
5 revisions
Algorithms.Memoize(TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult) Method (Func(TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult), Boolean)
Caches function value for specific arguments.
Namespace: CodeJam
Assembly: CodeJam (in CodeJam.dll) Version: 1.1.0.0 (1.1.0.0)
C#
public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult> Memoize<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult>(
this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult> func,
bool threadSafe = false
)
VB
<ExtensionAttribute>
Public Shared Function Memoize(Of TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult) (
func As Func(Of TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult),
Optional threadSafe As Boolean = false
) As Func(Of TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult)
F#
[<ExtensionAttribute>]
static member Memoize :
func : Func<'TArg1, 'TArg2, 'TArg3, 'TArg4, 'TArg5, 'TArg6, 'TArg7, 'TResult> *
?threadSafe : bool
(* Defaults:
let _threadSafe = defaultArg threadSafe false
*)
-> Func<'TArg1, 'TArg2, 'TArg3, 'TArg4, 'TArg5, 'TArg6, 'TArg7, 'TResult>
- func
- Type: System.Func(TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult)
Function to memoize. - threadSafe (Optional)
- Type: System.Boolean
If true - returns thread safe implementation
- TArg1
- Type of argument 1
- TArg2
- Type of argument 2
- TArg3
- Type of argument 3
- TArg4
- Type of argument 4
- TArg5
- Type of argument 5
- TArg6
- Type of argument 6
- TArg7
- Type of argument 7
- TResult
- Type of result
Type: Func(TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult)
Memoized function
In Visual Basic and C#, you can call this method as an instance method on any object of type Func(TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TResult). When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).