Skip to content

Commit 8f63065

Browse files
eerhardtJamesNK
andauthored
Change Router _emptyParametersDictionary to a regular Dictionary (#31460)
* Change Router _emptyParametersDictionary to a regular Dictionary This allows for ReadOnlyDictionary to be trimmed in a default Blazor WASM app. Saving roughly 3 KB .br compressed. Contributes to #30098 * Update src/Components/Components/src/Routing/Router.cs Co-authored-by: James Newton-King <[email protected]>
1 parent 8d721cf commit 8f63065

File tree

1 file changed

+3
-2
lines changed
  • src/Components/Components/src/Routing

1 file changed

+3
-2
lines changed

src/Components/Components/src/Routing/Router.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ namespace Microsoft.AspNetCore.Components.Routing
2121
public class Router : IComponent, IHandleAfterRender, IDisposable
2222
{
2323
static readonly char[] _queryOrHashStartChar = new[] { '?', '#' };
24-
static readonly ReadOnlyDictionary<string, object> _emptyParametersDictionary
25-
= new ReadOnlyDictionary<string, object>(new Dictionary<string, object>());
24+
// Dictionary is intentionally used instead of ReadOnlyDictionary to reduce Blazor size
25+
static readonly IReadOnlyDictionary<string, object> _emptyParametersDictionary
26+
= new Dictionary<string, object>();
2627

2728
RenderHandle _renderHandle;
2829
string _baseUri;

0 commit comments

Comments
 (0)