I have a JObject and try to call ToString() on GetValue().
JObject exampleJobject = new JObject();
string text = exampleJObject.GetValue("text").ToString();
If value does not exist it throws an exception. What is the most clever to only call ToString() if the value exist or to return a default value in case the value does not exist?
As a sidenote I want to avoid having to check explicitly for every value if it is null with an if statement before calling ToString().
JObject exampleJobject = new JObject();
JToken value = exampleJObject.GetValue("text");
string text = "";
if(null != value){
text = value.ToString();
}