Hi
At
https://github.com/JamesNK/Newtonsoft.Json/blob/master/Src/Newtonsoft.Json/Linq/JObject.cs#L544
ContainsKey is not public.
Where I could do
float x = hash.ContainsKey('x') ? (float)hash['x'] : 0f;
I am needing to write
float x;
JToken t;
if (hash.TryGetValue('x', out t)) {
x= (float)t;
} else { x = 0f; }
Or am I missing something?
Thanks
@ambs you could cast the JObject
to a IDictionary<string, JToken>
to get access to ContainsKey
(though I agree you shouldn't have to)
Yep, can't recall how, but I solved the issue. But always good to have it explicitly.
I meant to make it public in 10 but I forgot. It will be public in 11.
Most helpful comment
@ambs you could cast the
JObject
to aIDictionary<string, JToken>
to get access toContainsKey
(though I agree you shouldn't have to)