How to get value by key from JObject? : <p>I have a JObject like this:</p>

<pre><code>{
  "@STARTDATE": "'2016-02-17 00:00:00.000'",
  "@ENDDATE": "'2016-02-18 23:59:00.000'"
}
</code></pre>

<p>I want to get @STARTDATE and @ENDDATE value from JObject.</p>

<hr>

<p>This is a sample code that I've tried to do the task:</p>

<pre><code>JObject json = JObject.Parse("{\"@STARTDATE\": \"'2016-02-17 00:00:00.000'\",\"@ENDDATE\": \"'2016-02-18 23:59:00.000'\"}");
var key = "@STARTDATE";

var value = GetJArrayValue(json, key);

private string GetJArrayValue(JObject yourJArray, JToken key)
{
    string value = "";
    foreach (JToken item in yourJArray.Children())
    {
        var itemProperties = item.Children&lt;JProperty&gt;();
        //If the property name is equal to key, we get the value
        var myElement = itemProperties.FirstOrDefault(x =&gt; x.Name == key.ToString());
        value = myElement.Value.ToString(); //It run into an exception here because myElement is null
        break;
    }
    return value;
}
</code></pre>

<p><em>Note: The code above cannot get the value by key from JObject.</em></p>

<hr>

<p><strong>Could you help me to find a way to get the value by key from JObject?</strong></p>
