Skip to content

Commit df500bd

Browse files
authored
Use OrderedDictionary<TKey,TValue>.TryGetValue Method on more targets (#118441)
1 parent e7e3cc2 commit df500bd

File tree

1 file changed

+4
-4
lines changed
  • src/libraries/System.Text.Json/src/System/Text/Json/Nodes

1 file changed

+4
-4
lines changed

src/libraries/System.Text.Json/src/System/Text/Json/Nodes/JsonObject.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,14 @@ internal void SetItem(string propertyName, JsonNode? value)
267267
OrderedDictionary<string, JsonNode?> dict = Dictionary;
268268

269269
if (
270-
#if NET10_0_OR_GREATER
271-
!dict.TryAdd(propertyName, value, out int index)
272-
#else
270+
#if NET9_0
273271
!dict.TryAdd(propertyName, value)
272+
#else
273+
!dict.TryAdd(propertyName, value, out int index)
274274
#endif
275275
)
276276
{
277-
#if !NET10_0_OR_GREATER
277+
#if NET9_0
278278
int index = dict.IndexOf(propertyName);
279279
#endif
280280
Debug.Assert(index >= 0);

0 commit comments

Comments
 (0)