[]
        
(Showing Draft Content)

GrapeCity.ActiveReports.Rendering.Tools.FuncExtensions.Memoize

Memoize Method

Memoize<T, TResult>(Func<T, TResult>, bool, IEqualityComparer<T>, Func<T, bool>)

Memoizes a function with a single parameter.

Declaration
public static Func<T, TResult> Memoize<T, TResult>(this Func<T, TResult> func, bool threadSafe = false, IEqualityComparer<T> comparer = null, Func<T, bool> useCacheCondition = null)
Parameters
Type Name Description
Func<T, TResult> func

The function to memoize.

bool threadSafe

Indicates whether the memoization should be thread-safe.

IEqualityComparer<T> comparer

The equality comparer to use for the input parameter.

Func<T, bool> useCacheCondition

A function to determine if the result should be cached.

Returns
Type Description
Func<T, TResult>

A memoized version of the function.

Type Parameters
Name Description
T

The type of the input parameter.

TResult

The type of the result.

Memoize<T1, T2, TResult>(Func<T1, T2, TResult>, bool, Func<T1, T2, bool>)

Memoizes a function with two parameters.

Declaration
public static Func<T1, T2, TResult> Memoize<T1, T2, TResult>(this Func<T1, T2, TResult> func, bool threadSafe = false, Func<T1, T2, bool> useCacheCondition = null)
Parameters
Type Name Description
Func<T1, T2, TResult> func

The function to memoize.

bool threadSafe

Indicates whether the memoization should be thread-safe.

Func<T1, T2, bool> useCacheCondition

A function to determine if the result should be cached.

Returns
Type Description
Func<T1, T2, TResult>

A memoized version of the function.

Type Parameters
Name Description
T1

The type of the first input parameter.

T2

The type of the second input parameter.

TResult

The type of the result.

Memoize<T1, T2, T3, TResult>(Func<T1, T2, T3, TResult>, bool)

Memoizes a function with three parameters.

Declaration
public static Func<T1, T2, T3, TResult> Memoize<T1, T2, T3, TResult>(this Func<T1, T2, T3, TResult> func, bool threadSafe = false)
Parameters
Type Name Description
Func<T1, T2, T3, TResult> func

The function to memoize.

bool threadSafe

Indicates whether the memoization should be thread-safe.

Returns
Type Description
Func<T1, T2, T3, TResult>

A memoized version of the function.

Type Parameters
Name Description
T1

The type of the first input parameter.

T2

The type of the second input parameter.

T3

The type of the third input parameter.

TResult

The type of the result.

Memoize<T1, T2, T3, TResult>(Func<T1, T2, T3, TResult>, bool, Func<T1, T2, T3, bool>)

Memoizes a function with three parameters, with a condition to determine if the result should be cached.

Declaration
public static Func<T1, T2, T3, TResult> Memoize<T1, T2, T3, TResult>(this Func<T1, T2, T3, TResult> func, bool threadSafe, Func<T1, T2, T3, bool> useCacheCondition)
Parameters
Type Name Description
Func<T1, T2, T3, TResult> func

The function to memoize.

bool threadSafe

Indicates whether the memoization should be thread-safe.

Func<T1, T2, T3, bool> useCacheCondition

A function to determine if the result should be cached.

Returns
Type Description
Func<T1, T2, T3, TResult>

A memoized version of the function.

Type Parameters
Name Description
T1

The type of the first input parameter.

T2

The type of the second input parameter.

T3

The type of the third input parameter.

TResult

The type of the result.