Last active
August 26, 2020 15:28
-
-
Save idg10/8935bbb076166a668203bd010fd2817b to your computer and use it in GitHub Desktop.
Using patterns instead of as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (JToken.Parse(text) is JObject o) | |
{ | |
bool hasItem = o.ContainsKey("item"); | |
Console.WriteLine(hasItem); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment