1
<?xml version="1.0" encoding="utf-8"?>
2
<topic id="SerializationCallbacks" revisionNumber="1">
3
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
6
<para>Optional summary abstract</para>
10
<!-- Uncomment this to generate an outline of the section and sub-section
11
titles. Specify a numeric value as the inner text to limit it to
12
a specific number of sub-topics when creating the outline. Specify
13
zero (0) to limit it to top-level sections only. -->
14
<!-- <autoOutline /> -->
15
<para>Json.NET supports serialization callback methods. A callback can be used to manipulate an object before and after its serialization and deserialization by the JsonSerializer.</para>
18
<listItem><para><legacyBold>OnSerializing</legacyBold></para></listItem>
19
<listItem><para><legacyBold>OnSerialized</legacyBold></para></listItem>
20
<listItem><para><legacyBold>OnDeserializing</legacyBold></para></listItem>
21
<listItem><para><legacyBold>OnDeserialized</legacyBold></para></listItem>
24
To tell the serializer which methods should be called during the object's
25
serialization lifecycle, decorate a method with the appropraite attribute
26
(<codeEntityReference>T:System.Runtime.Serialization.OnSerializingAttribute</codeEntityReference>,
27
<codeEntityReference>T:System.Runtime.Serialization.OnSerializedAttribute</codeEntityReference>,
28
<codeEntityReference>T:System.Runtime.Serialization.OnDeserializingAttribute</codeEntityReference>,
29
<codeEntityReference>T:System.Runtime.Serialization.OnDeserializedAttribute</codeEntityReference>).
33
<!-- Add one or more top-level section elements. These are collapsible.
34
If using <autoOutline />, add an address attribute to identify it
35
and specify a title so that it can be jumped to with a hyperlink. -->
37
<title>Example</title>
39
<!-- Uncomment this to create a sub-section outline
41
<para>Example object with serialization callback methods:</para>
43
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="SerializationCallbacksObject" title="Serialization Callback Attributes" />
45
<para>The example object being serialized and deserialized by Json.NET:</para>
47
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="SerializationCallbacksExample" title="Serialization Callback Example" />
52
<codeEntityReference>T:System.Runtime.Serialization.OnSerializingAttribute</codeEntityReference>
53
<codeEntityReference>T:System.Runtime.Serialization.OnSerializedAttribute</codeEntityReference>
54
<codeEntityReference>T:System.Runtime.Serialization.OnDeserializingAttribute</codeEntityReference>
55
<codeEntityReference>T:System.Runtime.Serialization.OnDeserializedAttribute</codeEntityReference>
57
</developerConceptualDocument>
b'\\ No newline at end of file'