yangyin
2025-02-28 baa80d650adebcce70f1113cc1020c6039c159a0
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
using System;
 
namespace DPumpHydr.WinFrmUI.WenSkin.Json
{
    /// <summary>
    /// Specifies default value handling options for the <see cref="T:Newtonsoft.Json.JsonSerializer" />.
    /// </summary>
    /// <example>
    ///   <code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="ReducingSerializedJsonSizeDefaultValueHandlingObject" title="DefaultValueHandling Class" />
    ///   <code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="ReducingSerializedJsonSizeDefaultValueHandlingExample" title="DefaultValueHandling Ignore Example" />
    /// </example>
    [Flags]
    public enum DefaultValueHandling
    {
        /// <summary>
        /// Include members where the member value is the same as the member's default value when serializing objects.
        /// Included members are written to JSON. Has no effect when deserializing.
        /// </summary>
        Include = 0x0,
        /// <summary>
        /// Ignore members where the member value is the same as the member's default value when serializing objects
        /// so that is is not written to JSON.
        /// This option will ignore all default values (e.g. <c>null</c> for objects and nullable types; <c>0</c> for integers,
        /// decimals and floating point numbers; and <c>false</c> for booleans). The default value ignored can be changed by
        /// placing the <see cref="T:System.ComponentModel.DefaultValueAttribute" /> on the property.
        /// </summary>
        Ignore = 0x1,
        /// <summary>
        /// Members with a default value but no JSON will be set to their default value when deserializing.
        /// </summary>
        Populate = 0x2,
        /// <summary>
        /// Ignore members where the member value is the same as the member's default value when serializing objects
        /// and sets members to their default value when deserializing.
        /// </summary>
        IgnoreAndPopulate = 0x3
    }
}