~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?xml version="1.0" encoding="utf-8"?>
<topic id="SelectToken" revisionNumber="1">
  <developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
    <introduction>
      <para>
      <codeEntityReference>Overload:Newtonsoft.Json.Linq.JToken.SelectToken</codeEntityReference>
      provides a method to query LINQ to JSON using a single string path to a desired
      <codeEntityReference>T:Newtonsoft.Json.Linq.JToken</codeEntityReference>.
      SelectToken makes dynamic queries easy because the entire query is defined in a string.</para>
    </introduction>
    <section>
      <title>SelectToken</title>
      <content>
        <!-- Uncomment this to create a sub-section outline
        <autoOutline /> -->
        <para>SelectToken is a method on JToken and takes a string path to a child token.
        SelectToken returns the child token or a null reference if a token couldn't be
        found at the path's location.</para>
        <para>The path is made up of property names and array indexes separated by periods.
        Array indexes can use either square or round brackets. Both of the following are
        valid paths and are equivalent to each other: <codeInline>Manufacturers[0].Name</codeInline>
        and <codeInline>Manufacturers(0).Name</codeInline>.</para>

<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="SelectTokenComplex" title="SelectToken Example" />
      </content>
    </section>
    <section>
      <title>SelectToken with LINQ</title>
      <content>
        <!-- Uncomment this to create a sub-section outline
        <autoOutline /> -->
        <para>SelectToken can be used in combination with standard LINQ methods.</para>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="SelectTokenLinq" title="SelectToken With LINQ Example" />
      </content>
    </section>
    <relatedTopics>
      <externalLink>
        <linkText>LINQ to JSON</linkText>
        <linkUri>LINQtoJSON.htm</linkUri>
        <linkTarget>_self</linkTarget>
      </externalLink>

      <codeEntityReference>Overload:Newtonsoft.Json.Linq.JToken.SelectToken</codeEntityReference>
    </relatedTopics>
  </developerConceptualDocument>
</topic>