From eb372aaf569f61270fdfc38fa61164af815d277e Mon Sep 17 00:00:00 2001 From: Damir Ainullin Date: Sat, 30 Mar 2019 01:35:58 +0000 Subject: [PATCH] Replaced ContainsKey and getting by value with TryGetValue method (#2013) --- Src/Newtonsoft.Json/Linq/JPropertyKeyedCollection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Src/Newtonsoft.Json/Linq/JPropertyKeyedCollection.cs b/Src/Newtonsoft.Json/Linq/JPropertyKeyedCollection.cs index b80f696d..435e4573 100644 --- a/Src/Newtonsoft.Json/Linq/JPropertyKeyedCollection.cs +++ b/Src/Newtonsoft.Json/Linq/JPropertyKeyedCollection.cs @@ -129,7 +129,7 @@ namespace Newtonsoft.Json.Linq if (_dictionary != null) { - return _dictionary.ContainsKey(key) && Remove(_dictionary[key]); + return _dictionary.TryGetValue(key, out JToken value) && Remove(value); } return false;