File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
src/Http/Routing/src/Matching Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change 11// Licensed to the .NET Foundation under one or more agreements.
22// The .NET Foundation licenses this file to you under the MIT license.
33
4+ using System . Collections . Frozen ;
45using System . Linq ;
56using System . Text ;
67
@@ -10,7 +11,7 @@ internal sealed class DictionaryJumpTable : JumpTable
1011{
1112 private readonly int _defaultDestination ;
1213 private readonly int _exitDestination ;
13- private readonly Dictionary < string , int > _dictionary ;
14+ private readonly FrozenDictionary < string , int > _dictionary ;
1415
1516 public DictionaryJumpTable (
1617 int defaultDestination ,
@@ -20,11 +21,7 @@ public DictionaryJumpTable(
2021 _defaultDestination = defaultDestination ;
2122 _exitDestination = exitDestination ;
2223
23- _dictionary = new Dictionary < string , int > ( StringComparer . OrdinalIgnoreCase ) ;
24- for ( var i = 0 ; i < entries . Length ; i ++ )
25- {
26- _dictionary . Add ( entries [ i ] . text , entries [ i ] . destination ) ;
27- }
24+ _dictionary = entries . ToFrozenDictionary ( e => e . text , e => e . destination , StringComparer . OrdinalIgnoreCase ) ;
2825 }
2926
3027 public override int GetDestination ( string path , PathSegment segment )
You can’t perform that action at this time.
0 commit comments