Class FunctionMemoizationExtensions
Provides a set of extension methods for memoization of functions.
Inheritance
Namespace: System.Memory
Assembly: Nuqleon.Memory.dll
Syntax
public static class FunctionMemoizationExtensions : Object
Methods
Memoize<TResult>(Func<TResult>, MemoizationOptions)
Memoizes the specified function
.
Declaration
public static IMemoizedDelegate<Func<TResult>> Memoize<TResult>(this Func<TResult> function, MemoizationOptions options)
Parameters
Type | Name | Description |
---|---|---|
System.Func<TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
TResult | Type of the function result. |
Memoize<TDelegate>(IMemoizer, TDelegate, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
.
The memoization cache uses the default equality comparer for all the function's argument values.
Declaration
public static IMemoizedDelegate<TDelegate> Memoize<TDelegate>(this IMemoizer memoizer, TDelegate function, MemoizationOptions options)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
TDelegate | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<TDelegate> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
TDelegate | Type of the function. |
Memoize<TResult>(IMemoizer, Func<TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
.
Declaration
public static IMemoizedDelegate<Func<TResult>> Memoize<TResult>(this IMemoizer memoizer, Func<TResult> function, MemoizationOptions options)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>> Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> function, MemoizationOptions options)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
T7 | Type of the seventh function argument. |
T8 | Type of the eighth function argument. |
T9 | Type of the ninth function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>, MemoizationOptions, IEqualityComparer<T1>, IEqualityComparer<T2>, IEqualityComparer<T3>, IEqualityComparer<T4>, IEqualityComparer<T5>, IEqualityComparer<T6>, IEqualityComparer<T7>, IEqualityComparer<T8>, IEqualityComparer<T9>)
Memoizes the specified function
using the specified memoizer
and the specified comparers to compare function arguments against cache entries.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>> Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> function, MemoizationOptions options, IEqualityComparer<T1> comparer1, IEqualityComparer<T2> comparer2, IEqualityComparer<T3> comparer3, IEqualityComparer<T4> comparer4, IEqualityComparer<T5> comparer5, IEqualityComparer<T6> comparer6, IEqualityComparer<T7> comparer7, IEqualityComparer<T8> comparer8, IEqualityComparer<T9> comparer9)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
System.Collections.Generic.IEqualityComparer<T1> | comparer1 | Comparer to compare the first function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T2> | comparer2 | Comparer to compare the second function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T3> | comparer3 | Comparer to compare the third function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T4> | comparer4 | Comparer to compare the fourth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T5> | comparer5 | Comparer to compare the fifth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T6> | comparer6 | Comparer to compare the sixth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T7> | comparer7 | Comparer to compare the seventh function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T8> | comparer8 | Comparer to compare the eighth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T9> | comparer9 | Comparer to compare the ninth function argument during lookup in the memoization cache. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
T7 | Type of the seventh function argument. |
T8 | Type of the eighth function argument. |
T9 | Type of the ninth function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>> Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> function, MemoizationOptions options)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
T7 | Type of the seventh function argument. |
T8 | Type of the eighth function argument. |
T9 | Type of the ninth function argument. |
T10 | Type of the tenth function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>, MemoizationOptions, IEqualityComparer<T1>, IEqualityComparer<T2>, IEqualityComparer<T3>, IEqualityComparer<T4>, IEqualityComparer<T5>, IEqualityComparer<T6>, IEqualityComparer<T7>, IEqualityComparer<T8>, IEqualityComparer<T9>, IEqualityComparer<T10>)
Memoizes the specified function
using the specified memoizer
and the specified comparers to compare function arguments against cache entries.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>> Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> function, MemoizationOptions options, IEqualityComparer<T1> comparer1, IEqualityComparer<T2> comparer2, IEqualityComparer<T3> comparer3, IEqualityComparer<T4> comparer4, IEqualityComparer<T5> comparer5, IEqualityComparer<T6> comparer6, IEqualityComparer<T7> comparer7, IEqualityComparer<T8> comparer8, IEqualityComparer<T9> comparer9, IEqualityComparer<T10> comparer10)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
System.Collections.Generic.IEqualityComparer<T1> | comparer1 | Comparer to compare the first function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T2> | comparer2 | Comparer to compare the second function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T3> | comparer3 | Comparer to compare the third function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T4> | comparer4 | Comparer to compare the fourth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T5> | comparer5 | Comparer to compare the fifth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T6> | comparer6 | Comparer to compare the sixth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T7> | comparer7 | Comparer to compare the seventh function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T8> | comparer8 | Comparer to compare the eighth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T9> | comparer9 | Comparer to compare the ninth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T10> | comparer10 | Comparer to compare the tenth function argument during lookup in the memoization cache. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
T7 | Type of the seventh function argument. |
T8 | Type of the eighth function argument. |
T9 | Type of the ninth function argument. |
T10 | Type of the tenth function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>> Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> function, MemoizationOptions options)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
T7 | Type of the seventh function argument. |
T8 | Type of the eighth function argument. |
T9 | Type of the ninth function argument. |
T10 | Type of the tenth function argument. |
T11 | Type of the eleventh function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>, MemoizationOptions, IEqualityComparer<T1>, IEqualityComparer<T2>, IEqualityComparer<T3>, IEqualityComparer<T4>, IEqualityComparer<T5>, IEqualityComparer<T6>, IEqualityComparer<T7>, IEqualityComparer<T8>, IEqualityComparer<T9>, IEqualityComparer<T10>, IEqualityComparer<T11>)
Memoizes the specified function
using the specified memoizer
and the specified comparers to compare function arguments against cache entries.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>> Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> function, MemoizationOptions options, IEqualityComparer<T1> comparer1, IEqualityComparer<T2> comparer2, IEqualityComparer<T3> comparer3, IEqualityComparer<T4> comparer4, IEqualityComparer<T5> comparer5, IEqualityComparer<T6> comparer6, IEqualityComparer<T7> comparer7, IEqualityComparer<T8> comparer8, IEqualityComparer<T9> comparer9, IEqualityComparer<T10> comparer10, IEqualityComparer<T11> comparer11)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
System.Collections.Generic.IEqualityComparer<T1> | comparer1 | Comparer to compare the first function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T2> | comparer2 | Comparer to compare the second function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T3> | comparer3 | Comparer to compare the third function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T4> | comparer4 | Comparer to compare the fourth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T5> | comparer5 | Comparer to compare the fifth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T6> | comparer6 | Comparer to compare the sixth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T7> | comparer7 | Comparer to compare the seventh function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T8> | comparer8 | Comparer to compare the eighth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T9> | comparer9 | Comparer to compare the ninth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T10> | comparer10 | Comparer to compare the tenth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T11> | comparer11 | Comparer to compare the eleventh function argument during lookup in the memoization cache. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
T7 | Type of the seventh function argument. |
T8 | Type of the eighth function argument. |
T9 | Type of the ninth function argument. |
T10 | Type of the tenth function argument. |
T11 | Type of the eleventh function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>> Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> function, MemoizationOptions options)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
T7 | Type of the seventh function argument. |
T8 | Type of the eighth function argument. |
T9 | Type of the ninth function argument. |
T10 | Type of the tenth function argument. |
T11 | Type of the eleventh function argument. |
T12 | Type of the twelfth function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>, MemoizationOptions, IEqualityComparer<T1>, IEqualityComparer<T2>, IEqualityComparer<T3>, IEqualityComparer<T4>, IEqualityComparer<T5>, IEqualityComparer<T6>, IEqualityComparer<T7>, IEqualityComparer<T8>, IEqualityComparer<T9>, IEqualityComparer<T10>, IEqualityComparer<T11>, IEqualityComparer<T12>)
Memoizes the specified function
using the specified memoizer
and the specified comparers to compare function arguments against cache entries.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>> Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> function, MemoizationOptions options, IEqualityComparer<T1> comparer1, IEqualityComparer<T2> comparer2, IEqualityComparer<T3> comparer3, IEqualityComparer<T4> comparer4, IEqualityComparer<T5> comparer5, IEqualityComparer<T6> comparer6, IEqualityComparer<T7> comparer7, IEqualityComparer<T8> comparer8, IEqualityComparer<T9> comparer9, IEqualityComparer<T10> comparer10, IEqualityComparer<T11> comparer11, IEqualityComparer<T12> comparer12)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
System.Collections.Generic.IEqualityComparer<T1> | comparer1 | Comparer to compare the first function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T2> | comparer2 | Comparer to compare the second function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T3> | comparer3 | Comparer to compare the third function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T4> | comparer4 | Comparer to compare the fourth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T5> | comparer5 | Comparer to compare the fifth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T6> | comparer6 | Comparer to compare the sixth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T7> | comparer7 | Comparer to compare the seventh function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T8> | comparer8 | Comparer to compare the eighth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T9> | comparer9 | Comparer to compare the ninth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T10> | comparer10 | Comparer to compare the tenth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T11> | comparer11 | Comparer to compare the eleventh function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T12> | comparer12 | Comparer to compare the twelfth function argument during lookup in the memoization cache. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
T7 | Type of the seventh function argument. |
T8 | Type of the eighth function argument. |
T9 | Type of the ninth function argument. |
T10 | Type of the tenth function argument. |
T11 | Type of the eleventh function argument. |
T12 | Type of the twelfth function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>> Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> function, MemoizationOptions options)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
T7 | Type of the seventh function argument. |
T8 | Type of the eighth function argument. |
T9 | Type of the ninth function argument. |
T10 | Type of the tenth function argument. |
T11 | Type of the eleventh function argument. |
T12 | Type of the twelfth function argument. |
T13 | Type of the thirteenth function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>, MemoizationOptions, IEqualityComparer<T1>, IEqualityComparer<T2>, IEqualityComparer<T3>, IEqualityComparer<T4>, IEqualityComparer<T5>, IEqualityComparer<T6>, IEqualityComparer<T7>, IEqualityComparer<T8>, IEqualityComparer<T9>, IEqualityComparer<T10>, IEqualityComparer<T11>, IEqualityComparer<T12>, IEqualityComparer<T13>)
Memoizes the specified function
using the specified memoizer
and the specified comparers to compare function arguments against cache entries.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>> Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> function, MemoizationOptions options, IEqualityComparer<T1> comparer1, IEqualityComparer<T2> comparer2, IEqualityComparer<T3> comparer3, IEqualityComparer<T4> comparer4, IEqualityComparer<T5> comparer5, IEqualityComparer<T6> comparer6, IEqualityComparer<T7> comparer7, IEqualityComparer<T8> comparer8, IEqualityComparer<T9> comparer9, IEqualityComparer<T10> comparer10, IEqualityComparer<T11> comparer11, IEqualityComparer<T12> comparer12, IEqualityComparer<T13> comparer13)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
System.Collections.Generic.IEqualityComparer<T1> | comparer1 | Comparer to compare the first function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T2> | comparer2 | Comparer to compare the second function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T3> | comparer3 | Comparer to compare the third function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T4> | comparer4 | Comparer to compare the fourth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T5> | comparer5 | Comparer to compare the fifth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T6> | comparer6 | Comparer to compare the sixth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T7> | comparer7 | Comparer to compare the seventh function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T8> | comparer8 | Comparer to compare the eighth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T9> | comparer9 | Comparer to compare the ninth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T10> | comparer10 | Comparer to compare the tenth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T11> | comparer11 | Comparer to compare the eleventh function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T12> | comparer12 | Comparer to compare the twelfth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T13> | comparer13 | Comparer to compare the thirteenth function argument during lookup in the memoization cache. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
T7 | Type of the seventh function argument. |
T8 | Type of the eighth function argument. |
T9 | Type of the ninth function argument. |
T10 | Type of the tenth function argument. |
T11 | Type of the eleventh function argument. |
T12 | Type of the twelfth function argument. |
T13 | Type of the thirteenth function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>> Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> function, MemoizationOptions options)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
T7 | Type of the seventh function argument. |
T8 | Type of the eighth function argument. |
T9 | Type of the ninth function argument. |
T10 | Type of the tenth function argument. |
T11 | Type of the eleventh function argument. |
T12 | Type of the twelfth function argument. |
T13 | Type of the thirteenth function argument. |
T14 | Type of the fourteenth function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>, MemoizationOptions, IEqualityComparer<T1>, IEqualityComparer<T2>, IEqualityComparer<T3>, IEqualityComparer<T4>, IEqualityComparer<T5>, IEqualityComparer<T6>, IEqualityComparer<T7>, IEqualityComparer<T8>, IEqualityComparer<T9>, IEqualityComparer<T10>, IEqualityComparer<T11>, IEqualityComparer<T12>, IEqualityComparer<T13>, IEqualityComparer<T14>)
Memoizes the specified function
using the specified memoizer
and the specified comparers to compare function arguments against cache entries.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>> Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> function, MemoizationOptions options, IEqualityComparer<T1> comparer1, IEqualityComparer<T2> comparer2, IEqualityComparer<T3> comparer3, IEqualityComparer<T4> comparer4, IEqualityComparer<T5> comparer5, IEqualityComparer<T6> comparer6, IEqualityComparer<T7> comparer7, IEqualityComparer<T8> comparer8, IEqualityComparer<T9> comparer9, IEqualityComparer<T10> comparer10, IEqualityComparer<T11> comparer11, IEqualityComparer<T12> comparer12, IEqualityComparer<T13> comparer13, IEqualityComparer<T14> comparer14)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
System.Collections.Generic.IEqualityComparer<T1> | comparer1 | Comparer to compare the first function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T2> | comparer2 | Comparer to compare the second function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T3> | comparer3 | Comparer to compare the third function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T4> | comparer4 | Comparer to compare the fourth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T5> | comparer5 | Comparer to compare the fifth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T6> | comparer6 | Comparer to compare the sixth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T7> | comparer7 | Comparer to compare the seventh function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T8> | comparer8 | Comparer to compare the eighth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T9> | comparer9 | Comparer to compare the ninth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T10> | comparer10 | Comparer to compare the tenth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T11> | comparer11 | Comparer to compare the eleventh function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T12> | comparer12 | Comparer to compare the twelfth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T13> | comparer13 | Comparer to compare the thirteenth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T14> | comparer14 | Comparer to compare the fourteenth function argument during lookup in the memoization cache. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
T7 | Type of the seventh function argument. |
T8 | Type of the eighth function argument. |
T9 | Type of the ninth function argument. |
T10 | Type of the tenth function argument. |
T11 | Type of the eleventh function argument. |
T12 | Type of the twelfth function argument. |
T13 | Type of the thirteenth function argument. |
T14 | Type of the fourteenth function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>> Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> function, MemoizationOptions options)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
T7 | Type of the seventh function argument. |
T8 | Type of the eighth function argument. |
T9 | Type of the ninth function argument. |
T10 | Type of the tenth function argument. |
T11 | Type of the eleventh function argument. |
T12 | Type of the twelfth function argument. |
T13 | Type of the thirteenth function argument. |
T14 | Type of the fourteenth function argument. |
T15 | Type of the fifteenth function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>, MemoizationOptions, IEqualityComparer<T1>, IEqualityComparer<T2>, IEqualityComparer<T3>, IEqualityComparer<T4>, IEqualityComparer<T5>, IEqualityComparer<T6>, IEqualityComparer<T7>, IEqualityComparer<T8>, IEqualityComparer<T9>, IEqualityComparer<T10>, IEqualityComparer<T11>, IEqualityComparer<T12>, IEqualityComparer<T13>, IEqualityComparer<T14>, IEqualityComparer<T15>)
Memoizes the specified function
using the specified memoizer
and the specified comparers to compare function arguments against cache entries.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>> Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> function, MemoizationOptions options, IEqualityComparer<T1> comparer1, IEqualityComparer<T2> comparer2, IEqualityComparer<T3> comparer3, IEqualityComparer<T4> comparer4, IEqualityComparer<T5> comparer5, IEqualityComparer<T6> comparer6, IEqualityComparer<T7> comparer7, IEqualityComparer<T8> comparer8, IEqualityComparer<T9> comparer9, IEqualityComparer<T10> comparer10, IEqualityComparer<T11> comparer11, IEqualityComparer<T12> comparer12, IEqualityComparer<T13> comparer13, IEqualityComparer<T14> comparer14, IEqualityComparer<T15> comparer15)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
System.Collections.Generic.IEqualityComparer<T1> | comparer1 | Comparer to compare the first function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T2> | comparer2 | Comparer to compare the second function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T3> | comparer3 | Comparer to compare the third function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T4> | comparer4 | Comparer to compare the fourth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T5> | comparer5 | Comparer to compare the fifth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T6> | comparer6 | Comparer to compare the sixth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T7> | comparer7 | Comparer to compare the seventh function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T8> | comparer8 | Comparer to compare the eighth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T9> | comparer9 | Comparer to compare the ninth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T10> | comparer10 | Comparer to compare the tenth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T11> | comparer11 | Comparer to compare the eleventh function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T12> | comparer12 | Comparer to compare the twelfth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T13> | comparer13 | Comparer to compare the thirteenth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T14> | comparer14 | Comparer to compare the fourteenth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T15> | comparer15 | Comparer to compare the fifteenth function argument during lookup in the memoization cache. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
T7 | Type of the seventh function argument. |
T8 | Type of the eighth function argument. |
T9 | Type of the ninth function argument. |
T10 | Type of the tenth function argument. |
T11 | Type of the eleventh function argument. |
T12 | Type of the twelfth function argument. |
T13 | Type of the thirteenth function argument. |
T14 | Type of the fourteenth function argument. |
T15 | Type of the fifteenth function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>> Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> function, MemoizationOptions options)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
T7 | Type of the seventh function argument. |
T8 | Type of the eighth function argument. |
T9 | Type of the ninth function argument. |
T10 | Type of the tenth function argument. |
T11 | Type of the eleventh function argument. |
T12 | Type of the twelfth function argument. |
T13 | Type of the thirteenth function argument. |
T14 | Type of the fourteenth function argument. |
T15 | Type of the fifteenth function argument. |
T16 | Type of the sixteenth function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>, MemoizationOptions, IEqualityComparer<T1>, IEqualityComparer<T2>, IEqualityComparer<T3>, IEqualityComparer<T4>, IEqualityComparer<T5>, IEqualityComparer<T6>, IEqualityComparer<T7>, IEqualityComparer<T8>, IEqualityComparer<T9>, IEqualityComparer<T10>, IEqualityComparer<T11>, IEqualityComparer<T12>, IEqualityComparer<T13>, IEqualityComparer<T14>, IEqualityComparer<T15>, IEqualityComparer<T16>)
Memoizes the specified function
using the specified memoizer
and the specified comparers to compare function arguments against cache entries.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>> Memoize<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> function, MemoizationOptions options, IEqualityComparer<T1> comparer1, IEqualityComparer<T2> comparer2, IEqualityComparer<T3> comparer3, IEqualityComparer<T4> comparer4, IEqualityComparer<T5> comparer5, IEqualityComparer<T6> comparer6, IEqualityComparer<T7> comparer7, IEqualityComparer<T8> comparer8, IEqualityComparer<T9> comparer9, IEqualityComparer<T10> comparer10, IEqualityComparer<T11> comparer11, IEqualityComparer<T12> comparer12, IEqualityComparer<T13> comparer13, IEqualityComparer<T14> comparer14, IEqualityComparer<T15> comparer15, IEqualityComparer<T16> comparer16)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
System.Collections.Generic.IEqualityComparer<T1> | comparer1 | Comparer to compare the first function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T2> | comparer2 | Comparer to compare the second function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T3> | comparer3 | Comparer to compare the third function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T4> | comparer4 | Comparer to compare the fourth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T5> | comparer5 | Comparer to compare the fifth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T6> | comparer6 | Comparer to compare the sixth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T7> | comparer7 | Comparer to compare the seventh function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T8> | comparer8 | Comparer to compare the eighth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T9> | comparer9 | Comparer to compare the ninth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T10> | comparer10 | Comparer to compare the tenth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T11> | comparer11 | Comparer to compare the eleventh function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T12> | comparer12 | Comparer to compare the twelfth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T13> | comparer13 | Comparer to compare the thirteenth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T14> | comparer14 | Comparer to compare the fourteenth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T15> | comparer15 | Comparer to compare the fifteenth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T16> | comparer16 | Comparer to compare the sixteenth function argument during lookup in the memoization cache. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
T7 | Type of the seventh function argument. |
T8 | Type of the eighth function argument. |
T9 | Type of the ninth function argument. |
T10 | Type of the tenth function argument. |
T11 | Type of the eleventh function argument. |
T12 | Type of the twelfth function argument. |
T13 | Type of the thirteenth function argument. |
T14 | Type of the fourteenth function argument. |
T15 | Type of the fifteenth function argument. |
T16 | Type of the sixteenth function argument. |
TResult | Type of the function result. |
Memoize<T, TResult>(IMemoizer, Func<T, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
.
Declaration
public static IMemoizedDelegate<Func<T, TResult>> Memoize<T, TResult>(this IMemoizer memoizer, Func<T, TResult> function, MemoizationOptions options)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T | Type of the function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, TResult>(IMemoizer, Func<T1, T2, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
.
Declaration
public static IMemoizedDelegate<Func<T1, T2, TResult>> Memoize<T1, T2, TResult>(this IMemoizer memoizer, Func<T1, T2, TResult> function, MemoizationOptions options)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, TResult>(IMemoizer, Func<T1, T2, TResult>, MemoizationOptions, IEqualityComparer<T1>, IEqualityComparer<T2>)
Memoizes the specified function
using the specified memoizer
and the specified comparers to compare function arguments against cache entries.
Declaration
public static IMemoizedDelegate<Func<T1, T2, TResult>> Memoize<T1, T2, TResult>(this IMemoizer memoizer, Func<T1, T2, TResult> function, MemoizationOptions options, IEqualityComparer<T1> comparer1, IEqualityComparer<T2> comparer2)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
System.Collections.Generic.IEqualityComparer<T1> | comparer1 | Comparer to compare the first function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T2> | comparer2 | Comparer to compare the second function argument during lookup in the memoization cache. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, TResult>(IMemoizer, Func<T1, T2, T3, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, TResult>> Memoize<T1, T2, T3, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, TResult> function, MemoizationOptions options)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, TResult>(IMemoizer, Func<T1, T2, T3, TResult>, MemoizationOptions, IEqualityComparer<T1>, IEqualityComparer<T2>, IEqualityComparer<T3>)
Memoizes the specified function
using the specified memoizer
and the specified comparers to compare function arguments against cache entries.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, TResult>> Memoize<T1, T2, T3, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, TResult> function, MemoizationOptions options, IEqualityComparer<T1> comparer1, IEqualityComparer<T2> comparer2, IEqualityComparer<T3> comparer3)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
System.Collections.Generic.IEqualityComparer<T1> | comparer1 | Comparer to compare the first function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T2> | comparer2 | Comparer to compare the second function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T3> | comparer3 | Comparer to compare the third function argument during lookup in the memoization cache. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, TResult>(IMemoizer, Func<T1, T2, T3, T4, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, TResult>> Memoize<T1, T2, T3, T4, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, TResult> function, MemoizationOptions options)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, TResult>(IMemoizer, Func<T1, T2, T3, T4, TResult>, MemoizationOptions, IEqualityComparer<T1>, IEqualityComparer<T2>, IEqualityComparer<T3>, IEqualityComparer<T4>)
Memoizes the specified function
using the specified memoizer
and the specified comparers to compare function arguments against cache entries.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, TResult>> Memoize<T1, T2, T3, T4, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, TResult> function, MemoizationOptions options, IEqualityComparer<T1> comparer1, IEqualityComparer<T2> comparer2, IEqualityComparer<T3> comparer3, IEqualityComparer<T4> comparer4)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
System.Collections.Generic.IEqualityComparer<T1> | comparer1 | Comparer to compare the first function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T2> | comparer2 | Comparer to compare the second function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T3> | comparer3 | Comparer to compare the third function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T4> | comparer4 | Comparer to compare the fourth function argument during lookup in the memoization cache. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, TResult>> Memoize<T1, T2, T3, T4, T5, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, TResult> function, MemoizationOptions options)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, TResult>, MemoizationOptions, IEqualityComparer<T1>, IEqualityComparer<T2>, IEqualityComparer<T3>, IEqualityComparer<T4>, IEqualityComparer<T5>)
Memoizes the specified function
using the specified memoizer
and the specified comparers to compare function arguments against cache entries.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, TResult>> Memoize<T1, T2, T3, T4, T5, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, TResult> function, MemoizationOptions options, IEqualityComparer<T1> comparer1, IEqualityComparer<T2> comparer2, IEqualityComparer<T3> comparer3, IEqualityComparer<T4> comparer4, IEqualityComparer<T5> comparer5)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
System.Collections.Generic.IEqualityComparer<T1> | comparer1 | Comparer to compare the first function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T2> | comparer2 | Comparer to compare the second function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T3> | comparer3 | Comparer to compare the third function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T4> | comparer4 | Comparer to compare the fourth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T5> | comparer5 | Comparer to compare the fifth function argument during lookup in the memoization cache. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, TResult>> Memoize<T1, T2, T3, T4, T5, T6, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, TResult> function, MemoizationOptions options)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, TResult>, MemoizationOptions, IEqualityComparer<T1>, IEqualityComparer<T2>, IEqualityComparer<T3>, IEqualityComparer<T4>, IEqualityComparer<T5>, IEqualityComparer<T6>)
Memoizes the specified function
using the specified memoizer
and the specified comparers to compare function arguments against cache entries.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, TResult>> Memoize<T1, T2, T3, T4, T5, T6, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, TResult> function, MemoizationOptions options, IEqualityComparer<T1> comparer1, IEqualityComparer<T2> comparer2, IEqualityComparer<T3> comparer3, IEqualityComparer<T4> comparer4, IEqualityComparer<T5> comparer5, IEqualityComparer<T6> comparer6)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
System.Collections.Generic.IEqualityComparer<T1> | comparer1 | Comparer to compare the first function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T2> | comparer2 | Comparer to compare the second function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T3> | comparer3 | Comparer to compare the third function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T4> | comparer4 | Comparer to compare the fourth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T5> | comparer5 | Comparer to compare the fifth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T6> | comparer6 | Comparer to compare the sixth function argument during lookup in the memoization cache. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, T7, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, TResult>> Memoize<T1, T2, T3, T4, T5, T6, T7, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, TResult> function, MemoizationOptions options)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
T7 | Type of the seventh function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, T7, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, TResult>, MemoizationOptions, IEqualityComparer<T1>, IEqualityComparer<T2>, IEqualityComparer<T3>, IEqualityComparer<T4>, IEqualityComparer<T5>, IEqualityComparer<T6>, IEqualityComparer<T7>)
Memoizes the specified function
using the specified memoizer
and the specified comparers to compare function arguments against cache entries.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, TResult>> Memoize<T1, T2, T3, T4, T5, T6, T7, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, TResult> function, MemoizationOptions options, IEqualityComparer<T1> comparer1, IEqualityComparer<T2> comparer2, IEqualityComparer<T3> comparer3, IEqualityComparer<T4> comparer4, IEqualityComparer<T5> comparer5, IEqualityComparer<T6> comparer6, IEqualityComparer<T7> comparer7)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
System.Collections.Generic.IEqualityComparer<T1> | comparer1 | Comparer to compare the first function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T2> | comparer2 | Comparer to compare the second function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T3> | comparer3 | Comparer to compare the third function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T4> | comparer4 | Comparer to compare the fourth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T5> | comparer5 | Comparer to compare the fifth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T6> | comparer6 | Comparer to compare the sixth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T7> | comparer7 | Comparer to compare the seventh function argument during lookup in the memoization cache. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
T7 | Type of the seventh function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult>> Memoize<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> function, MemoizationOptions options)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
T7 | Type of the seventh function argument. |
T8 | Type of the eighth function argument. |
TResult | Type of the function result. |
Memoize<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(IMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult>, MemoizationOptions, IEqualityComparer<T1>, IEqualityComparer<T2>, IEqualityComparer<T3>, IEqualityComparer<T4>, IEqualityComparer<T5>, IEqualityComparer<T6>, IEqualityComparer<T7>, IEqualityComparer<T8>)
Memoizes the specified function
using the specified memoizer
and the specified comparers to compare function arguments against cache entries.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult>> Memoize<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(this IMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> function, MemoizationOptions options, IEqualityComparer<T1> comparer1, IEqualityComparer<T2> comparer2, IEqualityComparer<T3> comparer3, IEqualityComparer<T4> comparer4, IEqualityComparer<T5> comparer5, IEqualityComparer<T6> comparer6, IEqualityComparer<T7> comparer7, IEqualityComparer<T8> comparer8)
Parameters
Type | Name | Description |
---|---|---|
IMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
System.Collections.Generic.IEqualityComparer<T1> | comparer1 | Comparer to compare the first function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T2> | comparer2 | Comparer to compare the second function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T3> | comparer3 | Comparer to compare the third function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T4> | comparer4 | Comparer to compare the fourth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T5> | comparer5 | Comparer to compare the fifth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T6> | comparer6 | Comparer to compare the sixth function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T7> | comparer7 | Comparer to compare the seventh function argument during lookup in the memoization cache. |
System.Collections.Generic.IEqualityComparer<T8> | comparer8 | Comparer to compare the eighth function argument during lookup in the memoization cache. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. |
T2 | Type of the second function argument. |
T3 | Type of the third function argument. |
T4 | Type of the fourth function argument. |
T5 | Type of the fifth function argument. |
T6 | Type of the sixth function argument. |
T7 | Type of the seventh function argument. |
T8 | Type of the eighth function argument. |
TResult | Type of the function result. |
MemoizeWeak<TDelegate>(IWeakMemoizer, TDelegate, MemoizationOptions, IMemoizer)
Memoizes the specified function
using the specified weakMemoizer
without keeping arguments alive.
The memoization cache uses the default equality comparer for all the function's argument values.
If the delegate parameters contain value types, the memoizer
is used to memoize these.
Declaration
public static IMemoizedDelegate<TDelegate> MemoizeWeak<TDelegate>(this IWeakMemoizer weakMemoizer, TDelegate function, MemoizationOptions options, IMemoizer memoizer = null)
Parameters
Type | Name | Description |
---|---|---|
IWeakMemoizer | weakMemoizer | The weak memoizer used to memoize the function's arguments that are reference types. |
TDelegate | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
IMemoizer | memoizer | The memoizer used to memoize the function's arguments that are value types. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<TDelegate> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
TDelegate | Type of the function. |
MemoizeWeak<TResult>(IWeakMemoizer, Func<TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
.
Declaration
public static IMemoizedDelegate<Func<TResult>> MemoizeWeak<TResult>(this IWeakMemoizer memoizer, Func<TResult> function, MemoizationOptions options)
Parameters
Type | Name | Description |
---|---|---|
IWeakMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
TResult | Type of the function result. |
MemoizeWeak<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(IWeakMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
without keeping function arguments alive by the memoization cache.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>> MemoizeWeak<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(this IWeakMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> function, MemoizationOptions options)
where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class
Parameters
Type | Name | Description |
---|---|---|
IWeakMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. This type has to be a reference type. |
T2 | Type of the second function argument. This type has to be a reference type. |
T3 | Type of the third function argument. This type has to be a reference type. |
T4 | Type of the fourth function argument. This type has to be a reference type. |
T5 | Type of the fifth function argument. This type has to be a reference type. |
T6 | Type of the sixth function argument. This type has to be a reference type. |
T7 | Type of the seventh function argument. This type has to be a reference type. |
T8 | Type of the eighth function argument. This type has to be a reference type. |
T9 | Type of the ninth function argument. This type has to be a reference type. |
TResult | Type of the function result. |
Remarks
This method curries the specified function in order to build a hierarchy of weak reference memoization cache and can be expensive in terms of memory usage. If only a subset of function arguments need to be treated as weak references, consider manually curring the function, as illustrated below.
//
// The memoization cache for this function should not keep T1 alive, but T2 poses no risk for a space leak:
//
Func<T1, T2, R> f = (x, y) => { return /* implementation */ };
//
// Assume we have weak memoizers and regular memoizers available:
//
IMemoizer memstrong = ...;
IWeakMemoizer memweak = ...;
//
// With this, we can manually memoize the function by curring it, as shown in a step-by-step fashion below:
//
// 1. Just curry the function
//
Func<T1, Func<T2, R>> memf1 = x => y => f(x, y);
//
// 2. Memoize on the first argument using a weak memoizer
//
Func<T1, Func<T2, R>> memf2 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return y => f(x, y);
}).Delegate;
//
// 3. Memoize the inner function
//
Func<T1, Func<T2, R>> memf3 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return memstrong.Memoize<T2, R>(y => f(x, y)).Delegate;
}).Delegate;
//
// Finally, we can uncurry the memoized function:
//
Func<T1, T2, R> memf = (x, y) => memf3(x)(y);
Note that each entry in the weak memoization cache contains a closure over the first function argument due to the curried function application as well as a memoization cache for the second function argument. E.g. for a unary function there will be a total of 1 + N caches, where N is the number of (live references to) first function arguments that were fed to the memoized function.
MemoizeWeak<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(IWeakMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
without keeping function arguments alive by the memoization cache.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>> MemoizeWeak<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(this IWeakMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> function, MemoizationOptions options)
where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class where T10 : class
Parameters
Type | Name | Description |
---|---|---|
IWeakMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. This type has to be a reference type. |
T2 | Type of the second function argument. This type has to be a reference type. |
T3 | Type of the third function argument. This type has to be a reference type. |
T4 | Type of the fourth function argument. This type has to be a reference type. |
T5 | Type of the fifth function argument. This type has to be a reference type. |
T6 | Type of the sixth function argument. This type has to be a reference type. |
T7 | Type of the seventh function argument. This type has to be a reference type. |
T8 | Type of the eighth function argument. This type has to be a reference type. |
T9 | Type of the ninth function argument. This type has to be a reference type. |
T10 | Type of the tenth function argument. This type has to be a reference type. |
TResult | Type of the function result. |
Remarks
This method curries the specified function in order to build a hierarchy of weak reference memoization cache and can be expensive in terms of memory usage. If only a subset of function arguments need to be treated as weak references, consider manually curring the function, as illustrated below.
//
// The memoization cache for this function should not keep T1 alive, but T2 poses no risk for a space leak:
//
Func<T1, T2, R> f = (x, y) => { return /* implementation */ };
//
// Assume we have weak memoizers and regular memoizers available:
//
IMemoizer memstrong = ...;
IWeakMemoizer memweak = ...;
//
// With this, we can manually memoize the function by curring it, as shown in a step-by-step fashion below:
//
// 1. Just curry the function
//
Func<T1, Func<T2, R>> memf1 = x => y => f(x, y);
//
// 2. Memoize on the first argument using a weak memoizer
//
Func<T1, Func<T2, R>> memf2 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return y => f(x, y);
}).Delegate;
//
// 3. Memoize the inner function
//
Func<T1, Func<T2, R>> memf3 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return memstrong.Memoize<T2, R>(y => f(x, y)).Delegate;
}).Delegate;
//
// Finally, we can uncurry the memoized function:
//
Func<T1, T2, R> memf = (x, y) => memf3(x)(y);
Note that each entry in the weak memoization cache contains a closure over the first function argument due to the curried function application as well as a memoization cache for the second function argument. E.g. for a unary function there will be a total of 1 + N caches, where N is the number of (live references to) first function arguments that were fed to the memoized function.
MemoizeWeak<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>(IWeakMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
without keeping function arguments alive by the memoization cache.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>> MemoizeWeak<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>(this IWeakMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> function, MemoizationOptions options)
where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class where T10 : class where T11 : class
Parameters
Type | Name | Description |
---|---|---|
IWeakMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. This type has to be a reference type. |
T2 | Type of the second function argument. This type has to be a reference type. |
T3 | Type of the third function argument. This type has to be a reference type. |
T4 | Type of the fourth function argument. This type has to be a reference type. |
T5 | Type of the fifth function argument. This type has to be a reference type. |
T6 | Type of the sixth function argument. This type has to be a reference type. |
T7 | Type of the seventh function argument. This type has to be a reference type. |
T8 | Type of the eighth function argument. This type has to be a reference type. |
T9 | Type of the ninth function argument. This type has to be a reference type. |
T10 | Type of the tenth function argument. This type has to be a reference type. |
T11 | Type of the eleventh function argument. This type has to be a reference type. |
TResult | Type of the function result. |
Remarks
This method curries the specified function in order to build a hierarchy of weak reference memoization cache and can be expensive in terms of memory usage. If only a subset of function arguments need to be treated as weak references, consider manually curring the function, as illustrated below.
//
// The memoization cache for this function should not keep T1 alive, but T2 poses no risk for a space leak:
//
Func<T1, T2, R> f = (x, y) => { return /* implementation */ };
//
// Assume we have weak memoizers and regular memoizers available:
//
IMemoizer memstrong = ...;
IWeakMemoizer memweak = ...;
//
// With this, we can manually memoize the function by curring it, as shown in a step-by-step fashion below:
//
// 1. Just curry the function
//
Func<T1, Func<T2, R>> memf1 = x => y => f(x, y);
//
// 2. Memoize on the first argument using a weak memoizer
//
Func<T1, Func<T2, R>> memf2 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return y => f(x, y);
}).Delegate;
//
// 3. Memoize the inner function
//
Func<T1, Func<T2, R>> memf3 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return memstrong.Memoize<T2, R>(y => f(x, y)).Delegate;
}).Delegate;
//
// Finally, we can uncurry the memoized function:
//
Func<T1, T2, R> memf = (x, y) => memf3(x)(y);
Note that each entry in the weak memoization cache contains a closure over the first function argument due to the curried function application as well as a memoization cache for the second function argument. E.g. for a unary function there will be a total of 1 + N caches, where N is the number of (live references to) first function arguments that were fed to the memoized function.
MemoizeWeak<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>(IWeakMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
without keeping function arguments alive by the memoization cache.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>> MemoizeWeak<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>(this IWeakMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> function, MemoizationOptions options)
where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class where T10 : class where T11 : class where T12 : class
Parameters
Type | Name | Description |
---|---|---|
IWeakMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. This type has to be a reference type. |
T2 | Type of the second function argument. This type has to be a reference type. |
T3 | Type of the third function argument. This type has to be a reference type. |
T4 | Type of the fourth function argument. This type has to be a reference type. |
T5 | Type of the fifth function argument. This type has to be a reference type. |
T6 | Type of the sixth function argument. This type has to be a reference type. |
T7 | Type of the seventh function argument. This type has to be a reference type. |
T8 | Type of the eighth function argument. This type has to be a reference type. |
T9 | Type of the ninth function argument. This type has to be a reference type. |
T10 | Type of the tenth function argument. This type has to be a reference type. |
T11 | Type of the eleventh function argument. This type has to be a reference type. |
T12 | Type of the twelfth function argument. This type has to be a reference type. |
TResult | Type of the function result. |
Remarks
This method curries the specified function in order to build a hierarchy of weak reference memoization cache and can be expensive in terms of memory usage. If only a subset of function arguments need to be treated as weak references, consider manually curring the function, as illustrated below.
//
// The memoization cache for this function should not keep T1 alive, but T2 poses no risk for a space leak:
//
Func<T1, T2, R> f = (x, y) => { return /* implementation */ };
//
// Assume we have weak memoizers and regular memoizers available:
//
IMemoizer memstrong = ...;
IWeakMemoizer memweak = ...;
//
// With this, we can manually memoize the function by curring it, as shown in a step-by-step fashion below:
//
// 1. Just curry the function
//
Func<T1, Func<T2, R>> memf1 = x => y => f(x, y);
//
// 2. Memoize on the first argument using a weak memoizer
//
Func<T1, Func<T2, R>> memf2 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return y => f(x, y);
}).Delegate;
//
// 3. Memoize the inner function
//
Func<T1, Func<T2, R>> memf3 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return memstrong.Memoize<T2, R>(y => f(x, y)).Delegate;
}).Delegate;
//
// Finally, we can uncurry the memoized function:
//
Func<T1, T2, R> memf = (x, y) => memf3(x)(y);
Note that each entry in the weak memoization cache contains a closure over the first function argument due to the curried function application as well as a memoization cache for the second function argument. E.g. for a unary function there will be a total of 1 + N caches, where N is the number of (live references to) first function arguments that were fed to the memoized function.
MemoizeWeak<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>(IWeakMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
without keeping function arguments alive by the memoization cache.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>> MemoizeWeak<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>(this IWeakMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> function, MemoizationOptions options)
where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class where T10 : class where T11 : class where T12 : class where T13 : class
Parameters
Type | Name | Description |
---|---|---|
IWeakMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. This type has to be a reference type. |
T2 | Type of the second function argument. This type has to be a reference type. |
T3 | Type of the third function argument. This type has to be a reference type. |
T4 | Type of the fourth function argument. This type has to be a reference type. |
T5 | Type of the fifth function argument. This type has to be a reference type. |
T6 | Type of the sixth function argument. This type has to be a reference type. |
T7 | Type of the seventh function argument. This type has to be a reference type. |
T8 | Type of the eighth function argument. This type has to be a reference type. |
T9 | Type of the ninth function argument. This type has to be a reference type. |
T10 | Type of the tenth function argument. This type has to be a reference type. |
T11 | Type of the eleventh function argument. This type has to be a reference type. |
T12 | Type of the twelfth function argument. This type has to be a reference type. |
T13 | Type of the thirteenth function argument. This type has to be a reference type. |
TResult | Type of the function result. |
Remarks
This method curries the specified function in order to build a hierarchy of weak reference memoization cache and can be expensive in terms of memory usage. If only a subset of function arguments need to be treated as weak references, consider manually curring the function, as illustrated below.
//
// The memoization cache for this function should not keep T1 alive, but T2 poses no risk for a space leak:
//
Func<T1, T2, R> f = (x, y) => { return /* implementation */ };
//
// Assume we have weak memoizers and regular memoizers available:
//
IMemoizer memstrong = ...;
IWeakMemoizer memweak = ...;
//
// With this, we can manually memoize the function by curring it, as shown in a step-by-step fashion below:
//
// 1. Just curry the function
//
Func<T1, Func<T2, R>> memf1 = x => y => f(x, y);
//
// 2. Memoize on the first argument using a weak memoizer
//
Func<T1, Func<T2, R>> memf2 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return y => f(x, y);
}).Delegate;
//
// 3. Memoize the inner function
//
Func<T1, Func<T2, R>> memf3 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return memstrong.Memoize<T2, R>(y => f(x, y)).Delegate;
}).Delegate;
//
// Finally, we can uncurry the memoized function:
//
Func<T1, T2, R> memf = (x, y) => memf3(x)(y);
Note that each entry in the weak memoization cache contains a closure over the first function argument due to the curried function application as well as a memoization cache for the second function argument. E.g. for a unary function there will be a total of 1 + N caches, where N is the number of (live references to) first function arguments that were fed to the memoized function.
MemoizeWeak<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>(IWeakMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
without keeping function arguments alive by the memoization cache.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>> MemoizeWeak<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>(this IWeakMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> function, MemoizationOptions options)
where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class where T10 : class where T11 : class where T12 : class where T13 : class where T14 : class
Parameters
Type | Name | Description |
---|---|---|
IWeakMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. This type has to be a reference type. |
T2 | Type of the second function argument. This type has to be a reference type. |
T3 | Type of the third function argument. This type has to be a reference type. |
T4 | Type of the fourth function argument. This type has to be a reference type. |
T5 | Type of the fifth function argument. This type has to be a reference type. |
T6 | Type of the sixth function argument. This type has to be a reference type. |
T7 | Type of the seventh function argument. This type has to be a reference type. |
T8 | Type of the eighth function argument. This type has to be a reference type. |
T9 | Type of the ninth function argument. This type has to be a reference type. |
T10 | Type of the tenth function argument. This type has to be a reference type. |
T11 | Type of the eleventh function argument. This type has to be a reference type. |
T12 | Type of the twelfth function argument. This type has to be a reference type. |
T13 | Type of the thirteenth function argument. This type has to be a reference type. |
T14 | Type of the fourteenth function argument. This type has to be a reference type. |
TResult | Type of the function result. |
Remarks
This method curries the specified function in order to build a hierarchy of weak reference memoization cache and can be expensive in terms of memory usage. If only a subset of function arguments need to be treated as weak references, consider manually curring the function, as illustrated below.
//
// The memoization cache for this function should not keep T1 alive, but T2 poses no risk for a space leak:
//
Func<T1, T2, R> f = (x, y) => { return /* implementation */ };
//
// Assume we have weak memoizers and regular memoizers available:
//
IMemoizer memstrong = ...;
IWeakMemoizer memweak = ...;
//
// With this, we can manually memoize the function by curring it, as shown in a step-by-step fashion below:
//
// 1. Just curry the function
//
Func<T1, Func<T2, R>> memf1 = x => y => f(x, y);
//
// 2. Memoize on the first argument using a weak memoizer
//
Func<T1, Func<T2, R>> memf2 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return y => f(x, y);
}).Delegate;
//
// 3. Memoize the inner function
//
Func<T1, Func<T2, R>> memf3 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return memstrong.Memoize<T2, R>(y => f(x, y)).Delegate;
}).Delegate;
//
// Finally, we can uncurry the memoized function:
//
Func<T1, T2, R> memf = (x, y) => memf3(x)(y);
Note that each entry in the weak memoization cache contains a closure over the first function argument due to the curried function application as well as a memoization cache for the second function argument. E.g. for a unary function there will be a total of 1 + N caches, where N is the number of (live references to) first function arguments that were fed to the memoized function.
MemoizeWeak<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>(IWeakMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
without keeping function arguments alive by the memoization cache.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>> MemoizeWeak<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>(this IWeakMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> function, MemoizationOptions options)
where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class where T10 : class where T11 : class where T12 : class where T13 : class where T14 : class where T15 : class
Parameters
Type | Name | Description |
---|---|---|
IWeakMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. This type has to be a reference type. |
T2 | Type of the second function argument. This type has to be a reference type. |
T3 | Type of the third function argument. This type has to be a reference type. |
T4 | Type of the fourth function argument. This type has to be a reference type. |
T5 | Type of the fifth function argument. This type has to be a reference type. |
T6 | Type of the sixth function argument. This type has to be a reference type. |
T7 | Type of the seventh function argument. This type has to be a reference type. |
T8 | Type of the eighth function argument. This type has to be a reference type. |
T9 | Type of the ninth function argument. This type has to be a reference type. |
T10 | Type of the tenth function argument. This type has to be a reference type. |
T11 | Type of the eleventh function argument. This type has to be a reference type. |
T12 | Type of the twelfth function argument. This type has to be a reference type. |
T13 | Type of the thirteenth function argument. This type has to be a reference type. |
T14 | Type of the fourteenth function argument. This type has to be a reference type. |
T15 | Type of the fifteenth function argument. This type has to be a reference type. |
TResult | Type of the function result. |
Remarks
This method curries the specified function in order to build a hierarchy of weak reference memoization cache and can be expensive in terms of memory usage. If only a subset of function arguments need to be treated as weak references, consider manually curring the function, as illustrated below.
//
// The memoization cache for this function should not keep T1 alive, but T2 poses no risk for a space leak:
//
Func<T1, T2, R> f = (x, y) => { return /* implementation */ };
//
// Assume we have weak memoizers and regular memoizers available:
//
IMemoizer memstrong = ...;
IWeakMemoizer memweak = ...;
//
// With this, we can manually memoize the function by curring it, as shown in a step-by-step fashion below:
//
// 1. Just curry the function
//
Func<T1, Func<T2, R>> memf1 = x => y => f(x, y);
//
// 2. Memoize on the first argument using a weak memoizer
//
Func<T1, Func<T2, R>> memf2 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return y => f(x, y);
}).Delegate;
//
// 3. Memoize the inner function
//
Func<T1, Func<T2, R>> memf3 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return memstrong.Memoize<T2, R>(y => f(x, y)).Delegate;
}).Delegate;
//
// Finally, we can uncurry the memoized function:
//
Func<T1, T2, R> memf = (x, y) => memf3(x)(y);
Note that each entry in the weak memoization cache contains a closure over the first function argument due to the curried function application as well as a memoization cache for the second function argument. E.g. for a unary function there will be a total of 1 + N caches, where N is the number of (live references to) first function arguments that were fed to the memoized function.
MemoizeWeak<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>(IWeakMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
without keeping function arguments alive by the memoization cache.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>> MemoizeWeak<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>(this IWeakMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> function, MemoizationOptions options)
where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class where T10 : class where T11 : class where T12 : class where T13 : class where T14 : class where T15 : class where T16 : class
Parameters
Type | Name | Description |
---|---|---|
IWeakMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. This type has to be a reference type. |
T2 | Type of the second function argument. This type has to be a reference type. |
T3 | Type of the third function argument. This type has to be a reference type. |
T4 | Type of the fourth function argument. This type has to be a reference type. |
T5 | Type of the fifth function argument. This type has to be a reference type. |
T6 | Type of the sixth function argument. This type has to be a reference type. |
T7 | Type of the seventh function argument. This type has to be a reference type. |
T8 | Type of the eighth function argument. This type has to be a reference type. |
T9 | Type of the ninth function argument. This type has to be a reference type. |
T10 | Type of the tenth function argument. This type has to be a reference type. |
T11 | Type of the eleventh function argument. This type has to be a reference type. |
T12 | Type of the twelfth function argument. This type has to be a reference type. |
T13 | Type of the thirteenth function argument. This type has to be a reference type. |
T14 | Type of the fourteenth function argument. This type has to be a reference type. |
T15 | Type of the fifteenth function argument. This type has to be a reference type. |
T16 | Type of the sixteenth function argument. This type has to be a reference type. |
TResult | Type of the function result. |
Remarks
This method curries the specified function in order to build a hierarchy of weak reference memoization cache and can be expensive in terms of memory usage. If only a subset of function arguments need to be treated as weak references, consider manually curring the function, as illustrated below.
//
// The memoization cache for this function should not keep T1 alive, but T2 poses no risk for a space leak:
//
Func<T1, T2, R> f = (x, y) => { return /* implementation */ };
//
// Assume we have weak memoizers and regular memoizers available:
//
IMemoizer memstrong = ...;
IWeakMemoizer memweak = ...;
//
// With this, we can manually memoize the function by curring it, as shown in a step-by-step fashion below:
//
// 1. Just curry the function
//
Func<T1, Func<T2, R>> memf1 = x => y => f(x, y);
//
// 2. Memoize on the first argument using a weak memoizer
//
Func<T1, Func<T2, R>> memf2 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return y => f(x, y);
}).Delegate;
//
// 3. Memoize the inner function
//
Func<T1, Func<T2, R>> memf3 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return memstrong.Memoize<T2, R>(y => f(x, y)).Delegate;
}).Delegate;
//
// Finally, we can uncurry the memoized function:
//
Func<T1, T2, R> memf = (x, y) => memf3(x)(y);
Note that each entry in the weak memoization cache contains a closure over the first function argument due to the curried function application as well as a memoization cache for the second function argument. E.g. for a unary function there will be a total of 1 + N caches, where N is the number of (live references to) first function arguments that were fed to the memoized function.
MemoizeWeak<T, TResult>(IWeakMemoizer, Func<T, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
.
Declaration
public static IMemoizedDelegate<Func<T, TResult>> MemoizeWeak<T, TResult>(this IWeakMemoizer memoizer, Func<T, TResult> function, MemoizationOptions options)
where T : class
Parameters
Type | Name | Description |
---|---|---|
IWeakMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T | Type of the function argument. |
TResult | Type of the function result. |
MemoizeWeak<T1, T2, TResult>(IWeakMemoizer, Func<T1, T2, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
without keeping function arguments alive by the memoization cache.
Declaration
public static IMemoizedDelegate<Func<T1, T2, TResult>> MemoizeWeak<T1, T2, TResult>(this IWeakMemoizer memoizer, Func<T1, T2, TResult> function, MemoizationOptions options)
where T1 : class where T2 : class
Parameters
Type | Name | Description |
---|---|---|
IWeakMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. This type has to be a reference type. |
T2 | Type of the second function argument. This type has to be a reference type. |
TResult | Type of the function result. |
Remarks
This method curries the specified function in order to build a hierarchy of weak reference memoization cache and can be expensive in terms of memory usage. If only a subset of function arguments need to be treated as weak references, consider manually curring the function, as illustrated below.
//
// The memoization cache for this function should not keep T1 alive, but T2 poses no risk for a space leak:
//
Func<T1, T2, R> f = (x, y) => { return /* implementation */ };
//
// Assume we have weak memoizers and regular memoizers available:
//
IMemoizer memstrong = ...;
IWeakMemoizer memweak = ...;
//
// With this, we can manually memoize the function by curring it, as shown in a step-by-step fashion below:
//
// 1. Just curry the function
//
Func<T1, Func<T2, R>> memf1 = x => y => f(x, y);
//
// 2. Memoize on the first argument using a weak memoizer
//
Func<T1, Func<T2, R>> memf2 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return y => f(x, y);
}).Delegate;
//
// 3. Memoize the inner function
//
Func<T1, Func<T2, R>> memf3 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return memstrong.Memoize<T2, R>(y => f(x, y)).Delegate;
}).Delegate;
//
// Finally, we can uncurry the memoized function:
//
Func<T1, T2, R> memf = (x, y) => memf3(x)(y);
Note that each entry in the weak memoization cache contains a closure over the first function argument due to the curried function application as well as a memoization cache for the second function argument. E.g. for a unary function there will be a total of 1 + N caches, where N is the number of (live references to) first function arguments that were fed to the memoized function.
MemoizeWeak<T1, T2, T3, TResult>(IWeakMemoizer, Func<T1, T2, T3, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
without keeping function arguments alive by the memoization cache.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, TResult>> MemoizeWeak<T1, T2, T3, TResult>(this IWeakMemoizer memoizer, Func<T1, T2, T3, TResult> function, MemoizationOptions options)
where T1 : class where T2 : class where T3 : class
Parameters
Type | Name | Description |
---|---|---|
IWeakMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. This type has to be a reference type. |
T2 | Type of the second function argument. This type has to be a reference type. |
T3 | Type of the third function argument. This type has to be a reference type. |
TResult | Type of the function result. |
Remarks
This method curries the specified function in order to build a hierarchy of weak reference memoization cache and can be expensive in terms of memory usage. If only a subset of function arguments need to be treated as weak references, consider manually curring the function, as illustrated below.
//
// The memoization cache for this function should not keep T1 alive, but T2 poses no risk for a space leak:
//
Func<T1, T2, R> f = (x, y) => { return /* implementation */ };
//
// Assume we have weak memoizers and regular memoizers available:
//
IMemoizer memstrong = ...;
IWeakMemoizer memweak = ...;
//
// With this, we can manually memoize the function by curring it, as shown in a step-by-step fashion below:
//
// 1. Just curry the function
//
Func<T1, Func<T2, R>> memf1 = x => y => f(x, y);
//
// 2. Memoize on the first argument using a weak memoizer
//
Func<T1, Func<T2, R>> memf2 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return y => f(x, y);
}).Delegate;
//
// 3. Memoize the inner function
//
Func<T1, Func<T2, R>> memf3 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return memstrong.Memoize<T2, R>(y => f(x, y)).Delegate;
}).Delegate;
//
// Finally, we can uncurry the memoized function:
//
Func<T1, T2, R> memf = (x, y) => memf3(x)(y);
Note that each entry in the weak memoization cache contains a closure over the first function argument due to the curried function application as well as a memoization cache for the second function argument. E.g. for a unary function there will be a total of 1 + N caches, where N is the number of (live references to) first function arguments that were fed to the memoized function.
MemoizeWeak<T1, T2, T3, T4, TResult>(IWeakMemoizer, Func<T1, T2, T3, T4, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
without keeping function arguments alive by the memoization cache.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, TResult>> MemoizeWeak<T1, T2, T3, T4, TResult>(this IWeakMemoizer memoizer, Func<T1, T2, T3, T4, TResult> function, MemoizationOptions options)
where T1 : class where T2 : class where T3 : class where T4 : class
Parameters
Type | Name | Description |
---|---|---|
IWeakMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. This type has to be a reference type. |
T2 | Type of the second function argument. This type has to be a reference type. |
T3 | Type of the third function argument. This type has to be a reference type. |
T4 | Type of the fourth function argument. This type has to be a reference type. |
TResult | Type of the function result. |
Remarks
This method curries the specified function in order to build a hierarchy of weak reference memoization cache and can be expensive in terms of memory usage. If only a subset of function arguments need to be treated as weak references, consider manually curring the function, as illustrated below.
//
// The memoization cache for this function should not keep T1 alive, but T2 poses no risk for a space leak:
//
Func<T1, T2, R> f = (x, y) => { return /* implementation */ };
//
// Assume we have weak memoizers and regular memoizers available:
//
IMemoizer memstrong = ...;
IWeakMemoizer memweak = ...;
//
// With this, we can manually memoize the function by curring it, as shown in a step-by-step fashion below:
//
// 1. Just curry the function
//
Func<T1, Func<T2, R>> memf1 = x => y => f(x, y);
//
// 2. Memoize on the first argument using a weak memoizer
//
Func<T1, Func<T2, R>> memf2 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return y => f(x, y);
}).Delegate;
//
// 3. Memoize the inner function
//
Func<T1, Func<T2, R>> memf3 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return memstrong.Memoize<T2, R>(y => f(x, y)).Delegate;
}).Delegate;
//
// Finally, we can uncurry the memoized function:
//
Func<T1, T2, R> memf = (x, y) => memf3(x)(y);
Note that each entry in the weak memoization cache contains a closure over the first function argument due to the curried function application as well as a memoization cache for the second function argument. E.g. for a unary function there will be a total of 1 + N caches, where N is the number of (live references to) first function arguments that were fed to the memoized function.
MemoizeWeak<T1, T2, T3, T4, T5, TResult>(IWeakMemoizer, Func<T1, T2, T3, T4, T5, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
without keeping function arguments alive by the memoization cache.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, TResult>> MemoizeWeak<T1, T2, T3, T4, T5, TResult>(this IWeakMemoizer memoizer, Func<T1, T2, T3, T4, T5, TResult> function, MemoizationOptions options)
where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class
Parameters
Type | Name | Description |
---|---|---|
IWeakMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. This type has to be a reference type. |
T2 | Type of the second function argument. This type has to be a reference type. |
T3 | Type of the third function argument. This type has to be a reference type. |
T4 | Type of the fourth function argument. This type has to be a reference type. |
T5 | Type of the fifth function argument. This type has to be a reference type. |
TResult | Type of the function result. |
Remarks
This method curries the specified function in order to build a hierarchy of weak reference memoization cache and can be expensive in terms of memory usage. If only a subset of function arguments need to be treated as weak references, consider manually curring the function, as illustrated below.
//
// The memoization cache for this function should not keep T1 alive, but T2 poses no risk for a space leak:
//
Func<T1, T2, R> f = (x, y) => { return /* implementation */ };
//
// Assume we have weak memoizers and regular memoizers available:
//
IMemoizer memstrong = ...;
IWeakMemoizer memweak = ...;
//
// With this, we can manually memoize the function by curring it, as shown in a step-by-step fashion below:
//
// 1. Just curry the function
//
Func<T1, Func<T2, R>> memf1 = x => y => f(x, y);
//
// 2. Memoize on the first argument using a weak memoizer
//
Func<T1, Func<T2, R>> memf2 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return y => f(x, y);
}).Delegate;
//
// 3. Memoize the inner function
//
Func<T1, Func<T2, R>> memf3 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return memstrong.Memoize<T2, R>(y => f(x, y)).Delegate;
}).Delegate;
//
// Finally, we can uncurry the memoized function:
//
Func<T1, T2, R> memf = (x, y) => memf3(x)(y);
Note that each entry in the weak memoization cache contains a closure over the first function argument due to the curried function application as well as a memoization cache for the second function argument. E.g. for a unary function there will be a total of 1 + N caches, where N is the number of (live references to) first function arguments that were fed to the memoized function.
MemoizeWeak<T1, T2, T3, T4, T5, T6, TResult>(IWeakMemoizer, Func<T1, T2, T3, T4, T5, T6, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
without keeping function arguments alive by the memoization cache.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, TResult>> MemoizeWeak<T1, T2, T3, T4, T5, T6, TResult>(this IWeakMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, TResult> function, MemoizationOptions options)
where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class
Parameters
Type | Name | Description |
---|---|---|
IWeakMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. This type has to be a reference type. |
T2 | Type of the second function argument. This type has to be a reference type. |
T3 | Type of the third function argument. This type has to be a reference type. |
T4 | Type of the fourth function argument. This type has to be a reference type. |
T5 | Type of the fifth function argument. This type has to be a reference type. |
T6 | Type of the sixth function argument. This type has to be a reference type. |
TResult | Type of the function result. |
Remarks
This method curries the specified function in order to build a hierarchy of weak reference memoization cache and can be expensive in terms of memory usage. If only a subset of function arguments need to be treated as weak references, consider manually curring the function, as illustrated below.
//
// The memoization cache for this function should not keep T1 alive, but T2 poses no risk for a space leak:
//
Func<T1, T2, R> f = (x, y) => { return /* implementation */ };
//
// Assume we have weak memoizers and regular memoizers available:
//
IMemoizer memstrong = ...;
IWeakMemoizer memweak = ...;
//
// With this, we can manually memoize the function by curring it, as shown in a step-by-step fashion below:
//
// 1. Just curry the function
//
Func<T1, Func<T2, R>> memf1 = x => y => f(x, y);
//
// 2. Memoize on the first argument using a weak memoizer
//
Func<T1, Func<T2, R>> memf2 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return y => f(x, y);
}).Delegate;
//
// 3. Memoize the inner function
//
Func<T1, Func<T2, R>> memf3 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return memstrong.Memoize<T2, R>(y => f(x, y)).Delegate;
}).Delegate;
//
// Finally, we can uncurry the memoized function:
//
Func<T1, T2, R> memf = (x, y) => memf3(x)(y);
Note that each entry in the weak memoization cache contains a closure over the first function argument due to the curried function application as well as a memoization cache for the second function argument. E.g. for a unary function there will be a total of 1 + N caches, where N is the number of (live references to) first function arguments that were fed to the memoized function.
MemoizeWeak<T1, T2, T3, T4, T5, T6, T7, TResult>(IWeakMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
without keeping function arguments alive by the memoization cache.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, TResult>> MemoizeWeak<T1, T2, T3, T4, T5, T6, T7, TResult>(this IWeakMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, TResult> function, MemoizationOptions options)
where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class
Parameters
Type | Name | Description |
---|---|---|
IWeakMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. This type has to be a reference type. |
T2 | Type of the second function argument. This type has to be a reference type. |
T3 | Type of the third function argument. This type has to be a reference type. |
T4 | Type of the fourth function argument. This type has to be a reference type. |
T5 | Type of the fifth function argument. This type has to be a reference type. |
T6 | Type of the sixth function argument. This type has to be a reference type. |
T7 | Type of the seventh function argument. This type has to be a reference type. |
TResult | Type of the function result. |
Remarks
This method curries the specified function in order to build a hierarchy of weak reference memoization cache and can be expensive in terms of memory usage. If only a subset of function arguments need to be treated as weak references, consider manually curring the function, as illustrated below.
//
// The memoization cache for this function should not keep T1 alive, but T2 poses no risk for a space leak:
//
Func<T1, T2, R> f = (x, y) => { return /* implementation */ };
//
// Assume we have weak memoizers and regular memoizers available:
//
IMemoizer memstrong = ...;
IWeakMemoizer memweak = ...;
//
// With this, we can manually memoize the function by curring it, as shown in a step-by-step fashion below:
//
// 1. Just curry the function
//
Func<T1, Func<T2, R>> memf1 = x => y => f(x, y);
//
// 2. Memoize on the first argument using a weak memoizer
//
Func<T1, Func<T2, R>> memf2 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return y => f(x, y);
}).Delegate;
//
// 3. Memoize the inner function
//
Func<T1, Func<T2, R>> memf3 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return memstrong.Memoize<T2, R>(y => f(x, y)).Delegate;
}).Delegate;
//
// Finally, we can uncurry the memoized function:
//
Func<T1, T2, R> memf = (x, y) => memf3(x)(y);
Note that each entry in the weak memoization cache contains a closure over the first function argument due to the curried function application as well as a memoization cache for the second function argument. E.g. for a unary function there will be a total of 1 + N caches, where N is the number of (live references to) first function arguments that were fed to the memoized function.
MemoizeWeak<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(IWeakMemoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult>, MemoizationOptions)
Memoizes the specified function
using the specified memoizer
without keeping function arguments alive by the memoization cache.
Declaration
public static IMemoizedDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult>> MemoizeWeak<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(this IWeakMemoizer memoizer, Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> function, MemoizationOptions options)
where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class
Parameters
Type | Name | Description |
---|---|---|
IWeakMemoizer | memoizer | The memoizer used to memoize the function. |
System.Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> | function | The function to memoize. |
MemoizationOptions | options | Flags to influence the memoization behavior. |
Returns
Type | Description |
---|---|
IMemoizedDelegate<System.Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult>> | A memoized delegate containing the memoized function and providing access to the memoization cache. |
Type Parameters
Name | Description |
---|---|
T1 | Type of the first function argument. This type has to be a reference type. |
T2 | Type of the second function argument. This type has to be a reference type. |
T3 | Type of the third function argument. This type has to be a reference type. |
T4 | Type of the fourth function argument. This type has to be a reference type. |
T5 | Type of the fifth function argument. This type has to be a reference type. |
T6 | Type of the sixth function argument. This type has to be a reference type. |
T7 | Type of the seventh function argument. This type has to be a reference type. |
T8 | Type of the eighth function argument. This type has to be a reference type. |
TResult | Type of the function result. |
Remarks
This method curries the specified function in order to build a hierarchy of weak reference memoization cache and can be expensive in terms of memory usage. If only a subset of function arguments need to be treated as weak references, consider manually curring the function, as illustrated below.
//
// The memoization cache for this function should not keep T1 alive, but T2 poses no risk for a space leak:
//
Func<T1, T2, R> f = (x, y) => { return /* implementation */ };
//
// Assume we have weak memoizers and regular memoizers available:
//
IMemoizer memstrong = ...;
IWeakMemoizer memweak = ...;
//
// With this, we can manually memoize the function by curring it, as shown in a step-by-step fashion below:
//
// 1. Just curry the function
//
Func<T1, Func<T2, R>> memf1 = x => y => f(x, y);
//
// 2. Memoize on the first argument using a weak memoizer
//
Func<T1, Func<T2, R>> memf2 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return y => f(x, y);
}).Delegate;
//
// 3. Memoize the inner function
//
Func<T1, Func<T2, R>> memf3 = memweak.MemoizeWeak<T1, Func<T2, R>>(x =>
{
return memstrong.Memoize<T2, R>(y => f(x, y)).Delegate;
}).Delegate;
//
// Finally, we can uncurry the memoized function:
//
Func<T1, T2, R> memf = (x, y) => memf3(x)(y);
Note that each entry in the weak memoization cache contains a closure over the first function argument due to the curried function application as well as a memoization cache for the second function argument. E.g. for a unary function there will be a total of 1 + N caches, where N is the number of (live references to) first function arguments that were fed to the memoized function.