title: How to specify the type of TItem in Virtualize Component in Blazor WebAssembly inside a Generic Table Template
body: <p>I'm building a Generic Table Template in my <code>blazor webassembly</code> project. Following the <a href="https://docs.microsoft.com/en-us/aspnet/core/blazor/components/templated-components?view=aspnetcore-5.0" rel="noreferrer">docs</a>, I setup my table template and I'm trying to enable virtualization in my table template as follows.</p>
  <p><strong>TableTemplate.razor:</strong></p>
  <pre><code>@typeparam TItem
  
  &lt;table class=&quot;@CssClass&quot;&gt;
      &lt;thead&gt;
          &lt;tr&gt;@TableHeader&lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          @if (Virtualize)
          {
              &lt;Virtualize Context=&quot;item&quot; Items=&quot;Items&quot;&gt;
                  &lt;ItemContent&gt;
                      &lt;tr&gt;@RowTemplate(item)&lt;/tr&gt;
                  &lt;/ItemContent&gt;
                  &lt;Placeholder&gt;
                      &lt;p&gt;Loading..&lt;/p&gt;
                  &lt;/Placeholder&gt;
              &lt;/Virtualize&gt;
          }
          else
          {
              @foreach (var item in Items)
              {
                  &lt;tr&gt;@RowTemplate(item)&lt;/tr&gt;
              }
          }
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  <p><strong>TableTemplate.razor.cs:</strong></p>
  <pre><code>public partial class TableTemplate&lt;TItem&gt;
  {
      [Parameter]
      public string CssClass { get; set; }
  
      [Parameter]
      public bool Virtualize { get; set; }
  
      [Parameter]
      public RenderFragment TableHeader { get; set; }
  
      [Parameter]
      public RenderFragment&lt;TItem&gt; RowTemplate { get; set; }
  
      [Parameter]
      public IReadOnlyList&lt;TItem&gt; Items { get; set; }
  }
  </code></pre>
  <p>But I'm getting the below error,</p>
  <blockquote>
  <p>The type arguments for method
  'TypeInference.CreateVirtualize_0(RenderTreeBuilder, int, int,
  ICollection, int, RenderFragment, int,
  RenderFragment)' cannot be inferred from the
  usage.</p>
  </blockquote>
  <p>How to specify the type if <code>TItem</code> in Virtualize component? Please assist.</p>