@@ -24,7 +24,7 @@ private PropertyNode GetPropertyNodeFromJsonNode(string key, JsonNode? node)
2424 return new PropertyNode ( Context , key , node ?? JsonNullSentinel . JsonNull ) ;
2525 }
2626
27- private readonly List < PropertyNode > _nodes ;
27+ private readonly Dictionary < string , PropertyNode > _nodes ;
2828 public MapNode ( ParsingContext context , JsonNode node ) : base (
2929 context , node )
3030 {
@@ -34,16 +34,16 @@ public MapNode(ParsingContext context, JsonNode node) : base(
3434 }
3535
3636 _node = mapNode ;
37- _nodes = _node . Select ( p => GetPropertyNodeFromJsonNode ( p . Key , p . Value ) ) . ToList ( ) ;
37+ _nodes = _node . ToDictionary ( static p => p . Key , p => GetPropertyNodeFromJsonNode ( p . Key , p . Value ) , StringComparer . Ordinal ) ;
3838 }
3939
4040 public PropertyNode ? this [ string key ]
4141 {
4242 get
4343 {
44- if ( _node . TryGetPropertyValue ( key , out var value ) )
44+ if ( _node . ContainsKey ( key ) )
4545 {
46- return GetPropertyNodeFromJsonNode ( key , value ) ;
46+ return _nodes [ key ] ;
4747 }
4848
4949 return null ;
@@ -134,7 +134,7 @@ public override Dictionary<string, HashSet<T>> CreateArrayMap<T>(Func<ValueNode,
134134
135135 public IEnumerator < PropertyNode > GetEnumerator ( )
136136 {
137- return _nodes . GetEnumerator ( ) ;
137+ return _nodes . Values . GetEnumerator ( ) ;
138138 }
139139
140140 IEnumerator IEnumerable . GetEnumerator ( )
0 commit comments