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

« back to all changes in this revision

Viewing changes to external/Newtonsoft.Json/Doc/ContractResolver.aml

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
Import upstream version 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="utf-8"?>
 
2
<topic id="ContractResolver" revisionNumber="1">
 
3
  <developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
 
4
    <!--
 
5
    <summary>
 
6
      <para>Optional summary abstract</para>
 
7
    </summary>
 
8
    -->
 
9
    <introduction>
 
10
      <para>The <codeEntityReference>T:Newtonsoft.Json.Serialization.IContractResolver</codeEntityReference>
 
11
      interface provides a way to customize how the
 
12
      JsonSerializer serializes and deserializes .NET objects to JSON without placing attributes on your classes.
 
13
      </para>
 
14
      <para>Anything that can be set on an object, collection, property, etc, using attributes or methods to control serialization
 
15
      can also be set using an IContractResolver.</para>
 
16
    </introduction>
 
17
    <!-- Add one or more top-level section elements.  These are collapsible.
 
18
         If using <autoOutline />, add an address attribute to identify it
 
19
         and specify a title so that it can be jumped to with a hyperlink. -->
 
20
    <section>
 
21
      <title>DefaultContractResolver</title>
 
22
      <content>
 
23
        <!-- Uncomment this to create a sub-section outline
 
24
        <autoOutline /> -->
 
25
        <para>The <codeEntityReference>T:Newtonsoft.Json.Serialization.DefaultContractResolver</codeEntityReference>
 
26
        is the default resolver used by the
 
27
        serializer. It provides many avenues of extensibility in the form of
 
28
        virtual methods that can be overriden.</para>
 
29
      </content>
 
30
    </section>
 
31
    <section>
 
32
      <title>CamelCasePropertyNamesContractResolver</title>
 
33
      <content>
 
34
        <!-- Uncomment this to create a sub-section outline
 
35
        <autoOutline /> -->
 
36
        <para><codeEntityReference>T:Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver</codeEntityReference>
 
37
        inherits from DefaultContractResolver and simply overrides the JSON
 
38
        property name to be written in <externalLink>
 
39
<linkText>camelcase</linkText>
 
40
<linkUri>http://en.wikipedia.org/wiki/CamelCase</linkUri>
 
41
<linkTarget>_blank</linkTarget>
 
42
</externalLink>.</para>
 
43
 
 
44
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="ContractResolver" title="ContractResolver" />
 
45
      </content>
 
46
    </section>
 
47
    <section>
 
48
      <title>Custom IContractResolver Examples</title>
 
49
      <content>
 
50
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\PerformanceTests.cs" region="JsonConverterContractResolver" title="Use JsonConverter with IContractResolver" />
 
51
 
 
52
        <para>This example sets a <codeEntityReference>T:Newtonsoft.Json.JsonConverter</codeEntityReference> for a type
 
53
        using an IContractResolver. Using a contract resolver here is useful because DateTime is not your own type and it is not possible to place a JsonConverterAttribute on it.</para>
 
54
 
 
55
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\ConditionalPropertiesTests.cs" region="ShouldSerializeContractResolver" title="Conditional properties with IContractResolver" />
 
56
 
 
57
        <para>This example sets up <externalLink>
 
58
        <linkText>conditional serialization for a property</linkText>
 
59
        <linkUri>ConditionalProperties.htm</linkUri>
 
60
        <linkTarget>_self</linkTarget>
 
61
      </externalLink> using an IContractResolver. This is useful if you want to conditional serialize a property but don't want to add additional methods to your type.</para>
 
62
      </content>
 
63
    </section>
 
64
    <relatedTopics>
 
65
      <codeEntityReference>T:Newtonsoft.Json.Serialization.IContractResolver</codeEntityReference>
 
66
      <codeEntityReference>T:Newtonsoft.Json.Serialization.DefaultContractResolver</codeEntityReference>
 
67
      <codeEntityReference>T:Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver</codeEntityReference>
 
68
    </relatedTopics>
 
69
  </developerConceptualDocument>
 
70
</topic>
 
 
b'\\ No newline at end of file'