# GrapeCity.ActiveReports.Rendering.Tools.FuncExtensions.Memoize

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_ActiveReports_Rendering_Tools_FuncExtensions_Memoize_" data-uid="GrapeCity.ActiveReports.Rendering.Tools.FuncExtensions.Memoize*">Memoize Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_ActiveReports_Rendering_Tools_FuncExtensions_Memoize_" data-uid="GrapeCity.ActiveReports.Rendering.Tools.FuncExtensions.Memoize*"></a>
<h4 id="GrapeCity_ActiveReports_Rendering_Tools_FuncExtensions_Memoize__2_System_Func___0___1__System_Boolean_System_Collections_Generic_IEqualityComparer___0__System_Func___0_System_Boolean__" data-uid="GrapeCity.ActiveReports.Rendering.Tools.FuncExtensions.Memoize``2(System.Func{``0,``1},System.Boolean,System.Collections.Generic.IEqualityComparer{``0},System.Func{``0,System.Boolean})">Memoize&lt;T, TResult&gt;(Func&lt;T, TResult&gt;, bool, IEqualityComparer&lt;T&gt;, Func&lt;T, bool&gt;)</h4>
<div class="markdown level1 summary"><p>Memoizes a function with a single parameter.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static Func&lt;T, TResult&gt; Memoize&lt;T, TResult&gt;(this Func&lt;T, TResult&gt; func, bool threadSafe = false, IEqualityComparer&lt;T&gt; comparer = null, Func&lt;T, bool&gt; useCacheCondition = null)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;T, TResult&gt;</td>
      <td><span class="parametername">func</span></td>
      <td><p>The function to memoize.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">threadSafe</span></td>
      <td><p>Indicates whether the memoization should be thread-safe.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.iequalitycomparer-1">IEqualityComparer</a>&lt;T&gt;</td>
      <td><span class="parametername">comparer</span></td>
      <td><p>The equality comparer to use for the input parameter.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;T, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a>&gt;</td>
      <td><span class="parametername">useCacheCondition</span></td>
      <td><p>A function to determine if the result should be cached.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;T, TResult&gt;</td>
      <td><p>A memoized version of the function.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="typeParameters">Type Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="parametername">T</span></td>
      <td><p>The type of the input parameter.</p>
</td>
    </tr>
    <tr>
      <td><span class="parametername">TResult</span></td>
      <td><p>The type of the result.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_ActiveReports_Rendering_Tools_FuncExtensions_Memoize_" data-uid="GrapeCity.ActiveReports.Rendering.Tools.FuncExtensions.Memoize*"></a>
<h4 id="GrapeCity_ActiveReports_Rendering_Tools_FuncExtensions_Memoize__3_System_Func___0___1___2__System_Boolean_System_Func___0___1_System_Boolean__" data-uid="GrapeCity.ActiveReports.Rendering.Tools.FuncExtensions.Memoize``3(System.Func{``0,``1,``2},System.Boolean,System.Func{``0,``1,System.Boolean})">Memoize&lt;T1, T2, TResult&gt;(Func&lt;T1, T2, TResult&gt;, bool, Func&lt;T1, T2, bool&gt;)</h4>
<div class="markdown level1 summary"><p>Memoizes a function with two parameters.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static Func&lt;T1, T2, TResult&gt; Memoize&lt;T1, T2, TResult&gt;(this Func&lt;T1, T2, TResult&gt; func, bool threadSafe = false, Func&lt;T1, T2, bool&gt; useCacheCondition = null)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;T1, T2, TResult&gt;</td>
      <td><span class="parametername">func</span></td>
      <td><p>The function to memoize.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">threadSafe</span></td>
      <td><p>Indicates whether the memoization should be thread-safe.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;T1, T2, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a>&gt;</td>
      <td><span class="parametername">useCacheCondition</span></td>
      <td><p>A function to determine if the result should be cached.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;T1, T2, TResult&gt;</td>
      <td><p>A memoized version of the function.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="typeParameters">Type Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="parametername">T1</span></td>
      <td><p>The type of the first input parameter.</p>
</td>
    </tr>
    <tr>
      <td><span class="parametername">T2</span></td>
      <td><p>The type of the second input parameter.</p>
</td>
    </tr>
    <tr>
      <td><span class="parametername">TResult</span></td>
      <td><p>The type of the result.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_ActiveReports_Rendering_Tools_FuncExtensions_Memoize_" data-uid="GrapeCity.ActiveReports.Rendering.Tools.FuncExtensions.Memoize*"></a>
<h4 id="GrapeCity_ActiveReports_Rendering_Tools_FuncExtensions_Memoize__4_System_Func___0___1___2___3__System_Boolean_" data-uid="GrapeCity.ActiveReports.Rendering.Tools.FuncExtensions.Memoize``4(System.Func{``0,``1,``2,``3},System.Boolean)">Memoize&lt;T1, T2, T3, TResult&gt;(Func&lt;T1, T2, T3, TResult&gt;, bool)</h4>
<div class="markdown level1 summary"><p>Memoizes a function with three parameters.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static Func&lt;T1, T2, T3, TResult&gt; Memoize&lt;T1, T2, T3, TResult&gt;(this Func&lt;T1, T2, T3, TResult&gt; func, bool threadSafe = false)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-4">Func</a>&lt;T1, T2, T3, TResult&gt;</td>
      <td><span class="parametername">func</span></td>
      <td><p>The function to memoize.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">threadSafe</span></td>
      <td><p>Indicates whether the memoization should be thread-safe.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-4">Func</a>&lt;T1, T2, T3, TResult&gt;</td>
      <td><p>A memoized version of the function.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="typeParameters">Type Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="parametername">T1</span></td>
      <td><p>The type of the first input parameter.</p>
</td>
    </tr>
    <tr>
      <td><span class="parametername">T2</span></td>
      <td><p>The type of the second input parameter.</p>
</td>
    </tr>
    <tr>
      <td><span class="parametername">T3</span></td>
      <td><p>The type of the third input parameter.</p>
</td>
    </tr>
    <tr>
      <td><span class="parametername">TResult</span></td>
      <td><p>The type of the result.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_ActiveReports_Rendering_Tools_FuncExtensions_Memoize_" data-uid="GrapeCity.ActiveReports.Rendering.Tools.FuncExtensions.Memoize*"></a>
<h4 id="GrapeCity_ActiveReports_Rendering_Tools_FuncExtensions_Memoize__4_System_Func___0___1___2___3__System_Boolean_System_Func___0___1___2_System_Boolean__" data-uid="GrapeCity.ActiveReports.Rendering.Tools.FuncExtensions.Memoize``4(System.Func{``0,``1,``2,``3},System.Boolean,System.Func{``0,``1,``2,System.Boolean})">Memoize&lt;T1, T2, T3, TResult&gt;(Func&lt;T1, T2, T3, TResult&gt;, bool, Func&lt;T1, T2, T3, bool&gt;)</h4>
<div class="markdown level1 summary"><p>Memoizes a function with three parameters, with a condition to determine if the result should be cached.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static Func&lt;T1, T2, T3, TResult&gt; Memoize&lt;T1, T2, T3, TResult&gt;(this Func&lt;T1, T2, T3, TResult&gt; func, bool threadSafe, Func&lt;T1, T2, T3, bool&gt; useCacheCondition)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-4">Func</a>&lt;T1, T2, T3, TResult&gt;</td>
      <td><span class="parametername">func</span></td>
      <td><p>The function to memoize.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">threadSafe</span></td>
      <td><p>Indicates whether the memoization should be thread-safe.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-4">Func</a>&lt;T1, T2, T3, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a>&gt;</td>
      <td><span class="parametername">useCacheCondition</span></td>
      <td><p>A function to determine if the result should be cached.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-4">Func</a>&lt;T1, T2, T3, TResult&gt;</td>
      <td><p>A memoized version of the function.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="typeParameters">Type Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="parametername">T1</span></td>
      <td><p>The type of the first input parameter.</p>
</td>
    </tr>
    <tr>
      <td><span class="parametername">T2</span></td>
      <td><p>The type of the second input parameter.</p>
</td>
    </tr>
    <tr>
      <td><span class="parametername">T3</span></td>
      <td><p>The type of the third input parameter.</p>
</td>
    </tr>
    <tr>
      <td><span class="parametername">TResult</span></td>
      <td><p>The type of the result.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
