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 1
1
// Licensed to the .NET Foundation under one or more agreements.
2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
4
+ using System . Collections . Frozen ;
4
5
using System . Linq ;
5
6
using System . Text ;
6
7
@@ -10,7 +11,7 @@ internal sealed class DictionaryJumpTable : JumpTable
10
11
{
11
12
private readonly int _defaultDestination ;
12
13
private readonly int _exitDestination ;
13
- private readonly Dictionary < string , int > _dictionary ;
14
+ private readonly FrozenDictionary < string , int > _dictionary ;
14
15
15
16
public DictionaryJumpTable (
16
17
int defaultDestination ,
@@ -20,11 +21,7 @@ public DictionaryJumpTable(
20
21
_defaultDestination = defaultDestination ;
21
22
_exitDestination = exitDestination ;
22
23
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 ) ;
28
25
}
29
26
30
27
public override int GetDestination ( string path , PathSegment segment )
You can’t perform that action at this time.
0 commit comments