Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Caches of method->delegate conversions in the Blazor QuickGrid source code

$
0
0

From the Blazor QuickGrid's source code:

// QuickGrid.razorprivate void RenderColumnHeaders(RenderTreeBuilder __builder){   foreach (var col in _columns)   {<th class="@ColumnHeaderClass(col)" aria-sort="@AriaSortValue(col)" @key="@col" scope="col"><div class="col-header-content">@col.HeaderContent</div>            @if (col == _displayOptionsForColumn)            {<div class="col-options">@col.ColumnOptions</div>            }</th>    }}// QuickGrid.razor.cs// Caches of method->delegate conversionsprivate readonly RenderFragment _renderColumnHeaders;public QuickGrid(){   _renderColumnHeaders = RenderColumnHeaders;}

As far as I understand, the RenderColumnHeaders method in the razor file is already the RenderFragment delegate. I can then easily use it directly in the razor markup without any overhead (which seems they are trying to avoid):

@{  RenderColumnHeaders(__builder);}@* or *@@((RenderFragment)RenderColumnHeaders)

What's the point of these 'Caches of method->delegate conversions' then?

Source code


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>