using System; namespace LC.Newtonsoft.Json.Linq { /// /// Specifies the settings used when loading JSON. /// public class JsonLoadSettings { private CommentHandling _commentHandling; private LineInfoHandling _lineInfoHandling; private DuplicatePropertyNameHandling _duplicatePropertyNameHandling; /// /// Initializes a new instance of the class. /// public JsonLoadSettings() { _lineInfoHandling = LineInfoHandling.Load; _commentHandling = CommentHandling.Ignore; _duplicatePropertyNameHandling = DuplicatePropertyNameHandling.Replace; } /// /// Gets or sets how JSON comments are handled when loading JSON. /// The default value is . /// /// The JSON comment handling. public CommentHandling CommentHandling { get => _commentHandling; set { if (value < CommentHandling.Ignore || value > CommentHandling.Load) { throw new ArgumentOutOfRangeException(nameof(value)); } _commentHandling = value; } } /// /// Gets or sets how JSON line info is handled when loading JSON. /// The default value is . /// /// The JSON line info handling. public LineInfoHandling LineInfoHandling { get => _lineInfoHandling; set { if (value < LineInfoHandling.Ignore || value > LineInfoHandling.Load) { throw new ArgumentOutOfRangeException(nameof(value)); } _lineInfoHandling = value; } } /// /// Gets or sets how duplicate property names in JSON objects are handled when loading JSON. /// The default value is . /// /// The JSON duplicate property name handling. public DuplicatePropertyNameHandling DuplicatePropertyNameHandling { get => _duplicatePropertyNameHandling; set { if (value < DuplicatePropertyNameHandling.Replace || value > DuplicatePropertyNameHandling.Error) { throw new ArgumentOutOfRangeException(nameof(value)); } _duplicatePropertyNameHandling = value; } } } }