Skip to content

M_CodeJam_Algorithms_Memoize__7_1

Andrew Koryavchenko edited this page Jun 17, 2018 · 2 revisions

Algorithms.Memoize(TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult) Method (Func(TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult), LazyThreadSafetyMode)

Caches function value for specific arguments.

Namespace: CodeJam
Assembly: CodeJam (in CodeJam.dll) Version: 2.1.0.0

Syntax

C#

public static Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult> Memoize<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult>(
	this Func<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult> func,
	LazyThreadSafetyMode threadSafety
)

VB

<ExtensionAttribute>
Public Shared Function Memoize(Of TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult) ( 
	func As Func(Of TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult),
	threadSafety As LazyThreadSafetyMode
) As Func(Of TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult)

F#

[<ExtensionAttribute>]
static member Memoize : 
        func : Func<'TArg1, 'TArg2, 'TArg3, 'TArg4, 'TArg5, 'TArg6, 'TResult> * 
        threadSafety : LazyThreadSafetyMode -> Func<'TArg1, 'TArg2, 'TArg3, 'TArg4, 'TArg5, 'TArg6, 'TResult> 

Parameters

 

func
Type: System.Func(TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult)
Function to memoize.
threadSafety
Type: System.Threading.LazyThreadSafetyMode
One of the enumeration values that specifies the thread safety mode.

Type Parameters

 

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
TResult
Type of result

Return Value

Type: Func(TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TResult)
Memoized function

Usage Note

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, 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).

See Also

Reference

Algorithms Class
Memoize Overload
CodeJam Namespace

Clone this wiki locally