[]
Memoizes a function with a single parameter.
public static Func<T, TResult> Memoize<T, TResult>(this Func<T, TResult> func, bool threadSafe = false, IEqualityComparer<T> comparer = null, Func<T, bool> useCacheCondition = null)
| Type | Name | Description |
|---|---|---|
| Func<T, TResult> | func | The function to memoize. |
| bool | threadSafe | Indicates whether the memoization should be thread-safe. |
| IEqualityComparer<T> | comparer | The equality comparer to use for the input parameter. |
| Func<T, bool> | useCacheCondition | A function to determine if the result should be cached. |
| Type | Description |
|---|---|
| Func<T, TResult> | A memoized version of the function. |
| Name | Description |
|---|---|
| T | The type of the input parameter. |
| TResult | The type of the result. |
Memoizes a function with two parameters.
public static Func<T1, T2, TResult> Memoize<T1, T2, TResult>(this Func<T1, T2, TResult> func, bool threadSafe = false, Func<T1, T2, bool> useCacheCondition = null)
| Type | Name | Description |
|---|---|---|
| Func<T1, T2, TResult> | func | The function to memoize. |
| bool | threadSafe | Indicates whether the memoization should be thread-safe. |
| Func<T1, T2, bool> | useCacheCondition | A function to determine if the result should be cached. |
| Type | Description |
|---|---|
| Func<T1, T2, TResult> | A memoized version of the function. |
| Name | Description |
|---|---|
| T1 | The type of the first input parameter. |
| T2 | The type of the second input parameter. |
| TResult | The type of the result. |
Memoizes a function with three parameters.
public static Func<T1, T2, T3, TResult> Memoize<T1, T2, T3, TResult>(this Func<T1, T2, T3, TResult> func, bool threadSafe = false)
| Type | Name | Description |
|---|---|---|
| Func<T1, T2, T3, TResult> | func | The function to memoize. |
| bool | threadSafe | Indicates whether the memoization should be thread-safe. |
| Type | Description |
|---|---|
| Func<T1, T2, T3, TResult> | A memoized version of the function. |
| Name | Description |
|---|---|
| T1 | The type of the first input parameter. |
| T2 | The type of the second input parameter. |
| T3 | The type of the third input parameter. |
| TResult | The type of the result. |
Memoizes a function with three parameters, with a condition to determine if the result should be cached.
public static Func<T1, T2, T3, TResult> Memoize<T1, T2, T3, TResult>(this Func<T1, T2, T3, TResult> func, bool threadSafe, Func<T1, T2, T3, bool> useCacheCondition)
| Type | Name | Description |
|---|---|---|
| Func<T1, T2, T3, TResult> | func | The function to memoize. |
| bool | threadSafe | Indicates whether the memoization should be thread-safe. |
| Func<T1, T2, T3, bool> | useCacheCondition | A function to determine if the result should be cached. |
| Type | Description |
|---|---|
| Func<T1, T2, T3, TResult> | A memoized version of the function. |
| Name | Description |
|---|---|
| T1 | The type of the first input parameter. |
| T2 | The type of the second input parameter. |
| T3 | The type of the third input parameter. |
| TResult | The type of the result. |