-Refactor to expression body properties
This commit is contained in:
@@ -94,8 +94,8 @@ namespace Newtonsoft.Json.Bson
|
|||||||
[Obsolete("JsonNet35BinaryCompatibility will be removed in a future version of Json.NET.")]
|
[Obsolete("JsonNet35BinaryCompatibility will be removed in a future version of Json.NET.")]
|
||||||
public bool JsonNet35BinaryCompatibility
|
public bool JsonNet35BinaryCompatibility
|
||||||
{
|
{
|
||||||
get { return _jsonNet35BinaryCompatibility; }
|
get => _jsonNet35BinaryCompatibility;
|
||||||
set { _jsonNet35BinaryCompatibility = value; }
|
set => _jsonNet35BinaryCompatibility = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -106,8 +106,8 @@ namespace Newtonsoft.Json.Bson
|
|||||||
/// </value>
|
/// </value>
|
||||||
public bool ReadRootValueAsArray
|
public bool ReadRootValueAsArray
|
||||||
{
|
{
|
||||||
get { return _readRootValueAsArray; }
|
get => _readRootValueAsArray;
|
||||||
set { _readRootValueAsArray = value; }
|
set => _readRootValueAsArray = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -116,8 +116,8 @@ namespace Newtonsoft.Json.Bson
|
|||||||
/// <value>The <see cref="DateTimeKind" /> used when reading <see cref="DateTime"/> values from BSON.</value>
|
/// <value>The <see cref="DateTimeKind" /> used when reading <see cref="DateTime"/> values from BSON.</value>
|
||||||
public DateTimeKind DateTimeKindHandling
|
public DateTimeKind DateTimeKindHandling
|
||||||
{
|
{
|
||||||
get { return _dateTimeKindHandling; }
|
get => _dateTimeKindHandling;
|
||||||
set { _dateTimeKindHandling = value; }
|
set => _dateTimeKindHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -45,10 +45,7 @@ namespace Newtonsoft.Json.Bson
|
|||||||
token.Parent = this;
|
token.Parent = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override BsonType Type
|
public override BsonType Type => BsonType.Object;
|
||||||
{
|
|
||||||
get { return BsonType.Object; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerator<BsonProperty> GetEnumerator()
|
public IEnumerator<BsonProperty> GetEnumerator()
|
||||||
{
|
{
|
||||||
@@ -71,10 +68,7 @@ namespace Newtonsoft.Json.Bson
|
|||||||
token.Parent = this;
|
token.Parent = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override BsonType Type
|
public override BsonType Type => BsonType.Array;
|
||||||
{
|
|
||||||
get { return BsonType.Array; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerator<BsonToken> GetEnumerator()
|
public IEnumerator<BsonToken> GetEnumerator()
|
||||||
{
|
{
|
||||||
@@ -111,15 +105,9 @@ namespace Newtonsoft.Json.Bson
|
|||||||
_type = type;
|
_type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Value
|
public object Value => _value;
|
||||||
{
|
|
||||||
get { return _value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override BsonType Type
|
public override BsonType Type => _type;
|
||||||
{
|
|
||||||
get { return _type; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class BsonBoolean : BsonValue
|
internal class BsonBoolean : BsonValue
|
||||||
@@ -167,10 +155,7 @@ namespace Newtonsoft.Json.Bson
|
|||||||
Options = new BsonString(options, false);
|
Options = new BsonString(options, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override BsonType Type
|
public override BsonType Type => BsonType.Regex;
|
||||||
{
|
|
||||||
get { return BsonType.Regex; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class BsonProperty
|
internal class BsonProperty
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ namespace Newtonsoft.Json.Bson
|
|||||||
/// <value>The <see cref="DateTimeKind" /> used when writing <see cref="DateTime"/> values to BSON.</value>
|
/// <value>The <see cref="DateTimeKind" /> used when writing <see cref="DateTime"/> values to BSON.</value>
|
||||||
public DateTimeKind DateTimeKindHandling
|
public DateTimeKind DateTimeKindHandling
|
||||||
{
|
{
|
||||||
get { return _writer.DateTimeKindHandling; }
|
get => _writer.DateTimeKindHandling;
|
||||||
set { _writer.DateTimeKindHandling = value; }
|
set => _writer.DateTimeKindHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -96,9 +96,6 @@ namespace Newtonsoft.Json.Converters
|
|||||||
/// <value>
|
/// <value>
|
||||||
/// <c>true</c> if this <see cref="JsonConverter"/> can write JSON; otherwise, <c>false</c>.
|
/// <c>true</c> if this <see cref="JsonConverter"/> can write JSON; otherwise, <c>false</c>.
|
||||||
/// </value>
|
/// </value>
|
||||||
public override bool CanWrite
|
public override bool CanWrite => false;
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,8 +46,8 @@ namespace Newtonsoft.Json.Converters
|
|||||||
/// <value>The date time styles used when converting a date to and from JSON.</value>
|
/// <value>The date time styles used when converting a date to and from JSON.</value>
|
||||||
public DateTimeStyles DateTimeStyles
|
public DateTimeStyles DateTimeStyles
|
||||||
{
|
{
|
||||||
get { return _dateTimeStyles; }
|
get => _dateTimeStyles;
|
||||||
set { _dateTimeStyles = value; }
|
set => _dateTimeStyles = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -56,8 +56,8 @@ namespace Newtonsoft.Json.Converters
|
|||||||
/// <value>The date time format used when converting a date to and from JSON.</value>
|
/// <value>The date time format used when converting a date to and from JSON.</value>
|
||||||
public string DateTimeFormat
|
public string DateTimeFormat
|
||||||
{
|
{
|
||||||
get { return _dateTimeFormat ?? string.Empty; }
|
get => _dateTimeFormat ?? string.Empty;
|
||||||
set { _dateTimeFormat = (string.IsNullOrEmpty(value)) ? null : value; }
|
set => _dateTimeFormat = (string.IsNullOrEmpty(value)) ? null : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -66,8 +66,8 @@ namespace Newtonsoft.Json.Converters
|
|||||||
/// <value>The culture used when converting a date to and from JSON.</value>
|
/// <value>The culture used when converting a date to and from JSON.</value>
|
||||||
public CultureInfo Culture
|
public CultureInfo Culture
|
||||||
{
|
{
|
||||||
get { return _culture ?? CultureInfo.CurrentCulture; }
|
get => _culture ?? CultureInfo.CurrentCulture;
|
||||||
set { _culture = value; }
|
set => _culture = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ namespace Newtonsoft.Json
|
|||||||
/// <value><c>true</c> if null items are allowed in the collection; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if null items are allowed in the collection; otherwise, <c>false</c>.</value>
|
||||||
public bool AllowNullItems
|
public bool AllowNullItems
|
||||||
{
|
{
|
||||||
get { return _allowNullItems; }
|
get => _allowNullItems;
|
||||||
set { _allowNullItems = value; }
|
set => _allowNullItems = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace Newtonsoft.Json
|
|||||||
/// <value>The <see cref="Type"/> of the <see cref="NamingStrategy"/>.</value>
|
/// <value>The <see cref="Type"/> of the <see cref="NamingStrategy"/>.</value>
|
||||||
public Type NamingStrategyType
|
public Type NamingStrategyType
|
||||||
{
|
{
|
||||||
get { return _namingStrategyType; }
|
get => _namingStrategyType;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_namingStrategyType = value;
|
_namingStrategyType = value;
|
||||||
@@ -98,7 +98,7 @@ namespace Newtonsoft.Json
|
|||||||
/// </example>
|
/// </example>
|
||||||
public object[] NamingStrategyParameters
|
public object[] NamingStrategyParameters
|
||||||
{
|
{
|
||||||
get { return _namingStrategyParameters; }
|
get => _namingStrategyParameters;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_namingStrategyParameters = value;
|
_namingStrategyParameters = value;
|
||||||
@@ -125,8 +125,8 @@ namespace Newtonsoft.Json
|
|||||||
/// </value>
|
/// </value>
|
||||||
public bool IsReference
|
public bool IsReference
|
||||||
{
|
{
|
||||||
get { return _isReference ?? default(bool); }
|
get => _isReference ?? default(bool);
|
||||||
set { _isReference = value; }
|
set => _isReference = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -137,8 +137,8 @@ namespace Newtonsoft.Json
|
|||||||
/// </value>
|
/// </value>
|
||||||
public bool ItemIsReference
|
public bool ItemIsReference
|
||||||
{
|
{
|
||||||
get { return _itemIsReference ?? default(bool); }
|
get => _itemIsReference ?? default(bool);
|
||||||
set { _itemIsReference = value; }
|
set => _itemIsReference = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -147,8 +147,8 @@ namespace Newtonsoft.Json
|
|||||||
/// <value>The reference loop handling.</value>
|
/// <value>The reference loop handling.</value>
|
||||||
public ReferenceLoopHandling ItemReferenceLoopHandling
|
public ReferenceLoopHandling ItemReferenceLoopHandling
|
||||||
{
|
{
|
||||||
get { return _itemReferenceLoopHandling ?? default(ReferenceLoopHandling); }
|
get => _itemReferenceLoopHandling ?? default(ReferenceLoopHandling);
|
||||||
set { _itemReferenceLoopHandling = value; }
|
set => _itemReferenceLoopHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -157,8 +157,8 @@ namespace Newtonsoft.Json
|
|||||||
/// <value>The type name handling.</value>
|
/// <value>The type name handling.</value>
|
||||||
public TypeNameHandling ItemTypeNameHandling
|
public TypeNameHandling ItemTypeNameHandling
|
||||||
{
|
{
|
||||||
get { return _itemTypeNameHandling ?? default(TypeNameHandling); }
|
get => _itemTypeNameHandling ?? default(TypeNameHandling);
|
||||||
set { _itemTypeNameHandling = value; }
|
set => _itemTypeNameHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -65,19 +65,13 @@ namespace Newtonsoft.Json
|
|||||||
/// Gets a value indicating whether this <see cref="JsonConverter"/> can read JSON.
|
/// Gets a value indicating whether this <see cref="JsonConverter"/> can read JSON.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if this <see cref="JsonConverter"/> can read JSON; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this <see cref="JsonConverter"/> can read JSON; otherwise, <c>false</c>.</value>
|
||||||
public virtual bool CanRead
|
public virtual bool CanRead => true;
|
||||||
{
|
|
||||||
get { return true; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this <see cref="JsonConverter"/> can write JSON.
|
/// Gets a value indicating whether this <see cref="JsonConverter"/> can write JSON.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if this <see cref="JsonConverter"/> can write JSON; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this <see cref="JsonConverter"/> can write JSON; otherwise, <c>false</c>.</value>
|
||||||
public virtual bool CanWrite
|
public virtual bool CanWrite => true;
|
||||||
{
|
|
||||||
get { return true; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -41,10 +41,7 @@ namespace Newtonsoft.Json
|
|||||||
/// Gets the <see cref="Type"/> of the <see cref="JsonConverter"/>.
|
/// Gets the <see cref="Type"/> of the <see cref="JsonConverter"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The <see cref="Type"/> of the <see cref="JsonConverter"/>.</value>
|
/// <value>The <see cref="Type"/> of the <see cref="JsonConverter"/>.</value>
|
||||||
public Type ConverterType
|
public Type ConverterType => _converterType;
|
||||||
{
|
|
||||||
get { return _converterType; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The parameter list to use when constructing the <see cref="JsonConverter"/> described by <see cref="ConverterType"/>.
|
/// The parameter list to use when constructing the <see cref="JsonConverter"/> described by <see cref="ConverterType"/>.
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ namespace Newtonsoft.Json
|
|||||||
/// <value>The member serialization.</value>
|
/// <value>The member serialization.</value>
|
||||||
public MemberSerialization MemberSerialization
|
public MemberSerialization MemberSerialization
|
||||||
{
|
{
|
||||||
get { return _memberSerialization; }
|
get => _memberSerialization;
|
||||||
set { _memberSerialization = value; }
|
set => _memberSerialization = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -57,8 +57,8 @@ namespace Newtonsoft.Json
|
|||||||
/// </value>
|
/// </value>
|
||||||
public Required ItemRequired
|
public Required ItemRequired
|
||||||
{
|
{
|
||||||
get { return _itemRequired ?? default(Required); }
|
get => _itemRequired ?? default(Required);
|
||||||
set { _itemRequired = value; }
|
set => _itemRequired = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -92,8 +92,8 @@ namespace Newtonsoft.Json
|
|||||||
/// <value>The null value handling.</value>
|
/// <value>The null value handling.</value>
|
||||||
public NullValueHandling NullValueHandling
|
public NullValueHandling NullValueHandling
|
||||||
{
|
{
|
||||||
get { return _nullValueHandling ?? default(NullValueHandling); }
|
get => _nullValueHandling ?? default(NullValueHandling);
|
||||||
set { _nullValueHandling = value; }
|
set => _nullValueHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -102,8 +102,8 @@ namespace Newtonsoft.Json
|
|||||||
/// <value>The default value handling.</value>
|
/// <value>The default value handling.</value>
|
||||||
public DefaultValueHandling DefaultValueHandling
|
public DefaultValueHandling DefaultValueHandling
|
||||||
{
|
{
|
||||||
get { return _defaultValueHandling ?? default(DefaultValueHandling); }
|
get => _defaultValueHandling ?? default(DefaultValueHandling);
|
||||||
set { _defaultValueHandling = value; }
|
set => _defaultValueHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -112,8 +112,8 @@ namespace Newtonsoft.Json
|
|||||||
/// <value>The reference loop handling.</value>
|
/// <value>The reference loop handling.</value>
|
||||||
public ReferenceLoopHandling ReferenceLoopHandling
|
public ReferenceLoopHandling ReferenceLoopHandling
|
||||||
{
|
{
|
||||||
get { return _referenceLoopHandling ?? default(ReferenceLoopHandling); }
|
get => _referenceLoopHandling ?? default(ReferenceLoopHandling);
|
||||||
set { _referenceLoopHandling = value; }
|
set => _referenceLoopHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -122,8 +122,8 @@ namespace Newtonsoft.Json
|
|||||||
/// <value>The object creation handling.</value>
|
/// <value>The object creation handling.</value>
|
||||||
public ObjectCreationHandling ObjectCreationHandling
|
public ObjectCreationHandling ObjectCreationHandling
|
||||||
{
|
{
|
||||||
get { return _objectCreationHandling ?? default(ObjectCreationHandling); }
|
get => _objectCreationHandling ?? default(ObjectCreationHandling);
|
||||||
set { _objectCreationHandling = value; }
|
set => _objectCreationHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -132,8 +132,8 @@ namespace Newtonsoft.Json
|
|||||||
/// <value>The type name handling.</value>
|
/// <value>The type name handling.</value>
|
||||||
public TypeNameHandling TypeNameHandling
|
public TypeNameHandling TypeNameHandling
|
||||||
{
|
{
|
||||||
get { return _typeNameHandling ?? default(TypeNameHandling); }
|
get => _typeNameHandling ?? default(TypeNameHandling);
|
||||||
set { _typeNameHandling = value; }
|
set => _typeNameHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -142,8 +142,8 @@ namespace Newtonsoft.Json
|
|||||||
/// <value>Whether this property's value is serialized as a reference.</value>
|
/// <value>Whether this property's value is serialized as a reference.</value>
|
||||||
public bool IsReference
|
public bool IsReference
|
||||||
{
|
{
|
||||||
get { return _isReference ?? default(bool); }
|
get => _isReference ?? default(bool);
|
||||||
set { _isReference = value; }
|
set => _isReference = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -152,8 +152,8 @@ namespace Newtonsoft.Json
|
|||||||
/// <value>The numeric order of serialization.</value>
|
/// <value>The numeric order of serialization.</value>
|
||||||
public int Order
|
public int Order
|
||||||
{
|
{
|
||||||
get { return _order ?? default(int); }
|
get => _order ?? default(int);
|
||||||
set { _order = value; }
|
set => _order = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -164,8 +164,8 @@ namespace Newtonsoft.Json
|
|||||||
/// </value>
|
/// </value>
|
||||||
public Required Required
|
public Required Required
|
||||||
{
|
{
|
||||||
get { return _required ?? Required.Default; }
|
get => _required ?? Required.Default;
|
||||||
set { _required = value; }
|
set => _required = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -180,8 +180,8 @@ namespace Newtonsoft.Json
|
|||||||
/// <value>The collection's items reference loop handling.</value>
|
/// <value>The collection's items reference loop handling.</value>
|
||||||
public ReferenceLoopHandling ItemReferenceLoopHandling
|
public ReferenceLoopHandling ItemReferenceLoopHandling
|
||||||
{
|
{
|
||||||
get { return _itemReferenceLoopHandling ?? default(ReferenceLoopHandling); }
|
get => _itemReferenceLoopHandling ?? default(ReferenceLoopHandling);
|
||||||
set { _itemReferenceLoopHandling = value; }
|
set => _itemReferenceLoopHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -190,8 +190,8 @@ namespace Newtonsoft.Json
|
|||||||
/// <value>The collection's items type name handling.</value>
|
/// <value>The collection's items type name handling.</value>
|
||||||
public TypeNameHandling ItemTypeNameHandling
|
public TypeNameHandling ItemTypeNameHandling
|
||||||
{
|
{
|
||||||
get { return _itemTypeNameHandling ?? default(TypeNameHandling); }
|
get => _itemTypeNameHandling ?? default(TypeNameHandling);
|
||||||
set { _itemTypeNameHandling = value; }
|
set => _itemTypeNameHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -200,8 +200,8 @@ namespace Newtonsoft.Json
|
|||||||
/// <value>Whether this property's collection items are serialized as a reference.</value>
|
/// <value>Whether this property's collection items are serialized as a reference.</value>
|
||||||
public bool ItemIsReference
|
public bool ItemIsReference
|
||||||
{
|
{
|
||||||
get { return _itemIsReference ?? default(bool); }
|
get => _itemIsReference ?? default(bool);
|
||||||
set { _itemIsReference = value; }
|
set => _itemIsReference = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -32,11 +32,6 @@ using System.Numerics;
|
|||||||
#endif
|
#endif
|
||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
using Newtonsoft.Json.Utilities;
|
using Newtonsoft.Json.Utilities;
|
||||||
#if !HAVE_LINQ
|
|
||||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
|
||||||
#else
|
|
||||||
using System.Linq;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Newtonsoft.Json
|
namespace Newtonsoft.Json
|
||||||
{
|
{
|
||||||
@@ -135,10 +130,7 @@ namespace Newtonsoft.Json
|
|||||||
/// Gets the current reader state.
|
/// Gets the current reader state.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The current reader state.</value>
|
/// <value>The current reader state.</value>
|
||||||
protected State CurrentState
|
protected State CurrentState => _currentState;
|
||||||
{
|
|
||||||
get { return _currentState; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether the source should be closed when this reader is closed.
|
/// Gets or sets a value indicating whether the source should be closed when this reader is closed.
|
||||||
@@ -163,8 +155,8 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual char QuoteChar
|
public virtual char QuoteChar
|
||||||
{
|
{
|
||||||
get { return _quoteChar; }
|
get => _quoteChar;
|
||||||
protected internal set { _quoteChar = value; }
|
protected internal set => _quoteChar = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -172,7 +164,7 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTimeZoneHandling DateTimeZoneHandling
|
public DateTimeZoneHandling DateTimeZoneHandling
|
||||||
{
|
{
|
||||||
get { return _dateTimeZoneHandling; }
|
get => _dateTimeZoneHandling;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value < DateTimeZoneHandling.Local || value > DateTimeZoneHandling.RoundtripKind)
|
if (value < DateTimeZoneHandling.Local || value > DateTimeZoneHandling.RoundtripKind)
|
||||||
@@ -189,7 +181,7 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DateParseHandling DateParseHandling
|
public DateParseHandling DateParseHandling
|
||||||
{
|
{
|
||||||
get { return _dateParseHandling; }
|
get => _dateParseHandling;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value < DateParseHandling.None ||
|
if (value < DateParseHandling.None ||
|
||||||
@@ -212,7 +204,7 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public FloatParseHandling FloatParseHandling
|
public FloatParseHandling FloatParseHandling
|
||||||
{
|
{
|
||||||
get { return _floatParseHandling; }
|
get => _floatParseHandling;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value < FloatParseHandling.Double || value > FloatParseHandling.Decimal)
|
if (value < FloatParseHandling.Double || value > FloatParseHandling.Decimal)
|
||||||
@@ -229,8 +221,8 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string DateFormatString
|
public string DateFormatString
|
||||||
{
|
{
|
||||||
get { return _dateFormatString; }
|
get => _dateFormatString;
|
||||||
set { _dateFormatString = value; }
|
set => _dateFormatString = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -238,7 +230,7 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int? MaxDepth
|
public int? MaxDepth
|
||||||
{
|
{
|
||||||
get { return _maxDepth; }
|
get => _maxDepth;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value <= 0)
|
if (value <= 0)
|
||||||
@@ -253,26 +245,17 @@ namespace Newtonsoft.Json
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the type of the current JSON token.
|
/// Gets the type of the current JSON token.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual JsonToken TokenType
|
public virtual JsonToken TokenType => _tokenType;
|
||||||
{
|
|
||||||
get { return _tokenType; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the text value of the current JSON token.
|
/// Gets the text value of the current JSON token.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual object Value
|
public virtual object Value => _value;
|
||||||
{
|
|
||||||
get { return _value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the .NET type for the current JSON token.
|
/// Gets the .NET type for the current JSON token.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual Type ValueType
|
public virtual Type ValueType => _value?.GetType();
|
||||||
{
|
|
||||||
get { return _value?.GetType(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the depth of the current token in the JSON document.
|
/// Gets the depth of the current token in the JSON document.
|
||||||
@@ -282,7 +265,7 @@ namespace Newtonsoft.Json
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
int depth = (_stack != null) ? _stack.Count : 0;
|
int depth = _stack?.Count ?? 0;
|
||||||
if (JsonTokenUtils.IsStartToken(TokenType) || _currentPosition.Type == JsonContainerType.None)
|
if (JsonTokenUtils.IsStartToken(TokenType) || _currentPosition.Type == JsonContainerType.None)
|
||||||
{
|
{
|
||||||
return depth;
|
return depth;
|
||||||
@@ -321,8 +304,8 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public CultureInfo Culture
|
public CultureInfo Culture
|
||||||
{
|
{
|
||||||
get { return _culture ?? CultureInfo.InvariantCulture; }
|
get => _culture ?? CultureInfo.InvariantCulture;
|
||||||
set { _culture = value; }
|
set => _culture = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal JsonPosition GetPosition(int depth)
|
internal JsonPosition GetPosition(int depth)
|
||||||
|
|||||||
@@ -102,10 +102,7 @@ namespace Newtonsoft.Json
|
|||||||
set => _chars = value;
|
set => _chars = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal int CharPos
|
internal int CharPos => _charPos;
|
||||||
{
|
|
||||||
get => _charPos;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -113,7 +110,7 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public IArrayPool<char> ArrayPool
|
public IArrayPool<char> ArrayPool
|
||||||
{
|
{
|
||||||
get { return _arrayPool; }
|
get => _arrayPool;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == null)
|
if (value == null)
|
||||||
@@ -2582,9 +2579,6 @@ namespace Newtonsoft.Json
|
|||||||
/// <value>
|
/// <value>
|
||||||
/// The current line position or 0 if no line information is available (for example, <see cref="JsonTextReader.HasLineInfo"/> returns <c>false</c>).
|
/// The current line position or 0 if no line information is available (for example, <see cref="JsonTextReader.HasLineInfo"/> returns <c>false</c>).
|
||||||
/// </value>
|
/// </value>
|
||||||
public int LinePosition
|
public int LinePosition => _charPos - _lineStartPos;
|
||||||
{
|
|
||||||
get { return _charPos - _lineStartPos; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public IArrayPool<char> ArrayPool
|
public IArrayPool<char> ArrayPool
|
||||||
{
|
{
|
||||||
get { return _arrayPool; }
|
get => _arrayPool;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == null)
|
if (value == null)
|
||||||
@@ -88,7 +88,7 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int Indentation
|
public int Indentation
|
||||||
{
|
{
|
||||||
get { return _indentation; }
|
get => _indentation;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
@@ -105,7 +105,7 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public char QuoteChar
|
public char QuoteChar
|
||||||
{
|
{
|
||||||
get { return _quoteChar; }
|
get => _quoteChar;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value != '"' && value != '\'')
|
if (value != '"' && value != '\'')
|
||||||
@@ -123,7 +123,7 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public char IndentChar
|
public char IndentChar
|
||||||
{
|
{
|
||||||
get { return _indentChar; }
|
get => _indentChar;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value != _indentChar)
|
if (value != _indentChar)
|
||||||
@@ -139,8 +139,8 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool QuoteName
|
public bool QuoteName
|
||||||
{
|
{
|
||||||
get { return _quoteName; }
|
get => _quoteName;
|
||||||
set { _quoteName = value; }
|
set => _quoteName = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -66,20 +66,11 @@ namespace Newtonsoft.Json
|
|||||||
public IList<JToken> UniqueArrayItems { get; }
|
public IList<JToken> UniqueArrayItems { get; }
|
||||||
public JTokenWriter CurrentItemWriter { get; set; }
|
public JTokenWriter CurrentItemWriter { get; set; }
|
||||||
|
|
||||||
public IList<JsonSchemaModel> Schemas
|
public IList<JsonSchemaModel> Schemas => _schemas;
|
||||||
{
|
|
||||||
get { return _schemas; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dictionary<string, bool> RequiredProperties
|
public Dictionary<string, bool> RequiredProperties => _requiredProperties;
|
||||||
{
|
|
||||||
get { return _requiredProperties; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public JTokenType TokenType
|
public JTokenType TokenType => _tokenType;
|
||||||
{
|
|
||||||
get { return _tokenType; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public SchemaScope(JTokenType tokenType, IList<JsonSchemaModel> schemas)
|
public SchemaScope(JTokenType tokenType, IList<JsonSchemaModel> schemas)
|
||||||
{
|
{
|
||||||
@@ -121,27 +112,18 @@ namespace Newtonsoft.Json
|
|||||||
/// Gets the text value of the current JSON token.
|
/// Gets the text value of the current JSON token.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
/// <value></value>
|
||||||
public override object Value
|
public override object Value => _reader.Value;
|
||||||
{
|
|
||||||
get { return _reader.Value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the depth of the current token in the JSON document.
|
/// Gets the depth of the current token in the JSON document.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The depth of the current token in the JSON document.</value>
|
/// <value>The depth of the current token in the JSON document.</value>
|
||||||
public override int Depth
|
public override int Depth => _reader.Depth;
|
||||||
{
|
|
||||||
get { return _reader.Depth; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path of the current JSON token.
|
/// Gets the path of the current JSON token.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override string Path
|
public override string Path => _reader.Path;
|
||||||
{
|
|
||||||
get { return _reader.Path; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the quotation mark character used to enclose the value of a string.
|
/// Gets the quotation mark character used to enclose the value of a string.
|
||||||
@@ -157,19 +139,13 @@ namespace Newtonsoft.Json
|
|||||||
/// Gets the type of the current JSON token.
|
/// Gets the type of the current JSON token.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
/// <value></value>
|
||||||
public override JsonToken TokenType
|
public override JsonToken TokenType => _reader.TokenType;
|
||||||
{
|
|
||||||
get { return _reader.TokenType; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the .NET type for the current JSON token.
|
/// Gets the .NET type for the current JSON token.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
/// <value></value>
|
||||||
public override Type ValueType
|
public override Type ValueType => _reader.ValueType;
|
||||||
{
|
|
||||||
get { return _reader.ValueType; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Push(SchemaScope scope)
|
private void Push(SchemaScope scope)
|
||||||
{
|
{
|
||||||
@@ -187,10 +163,7 @@ namespace Newtonsoft.Json
|
|||||||
return poppedScope;
|
return poppedScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IList<JsonSchemaModel> CurrentSchemas
|
private IList<JsonSchemaModel> CurrentSchemas => _currentScope.Schemas;
|
||||||
{
|
|
||||||
get { return _currentScope.Schemas; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private static readonly IList<JsonSchemaModel> EmptySchemaList = new List<JsonSchemaModel>();
|
private static readonly IList<JsonSchemaModel> EmptySchemaList = new List<JsonSchemaModel>();
|
||||||
|
|
||||||
@@ -329,7 +302,7 @@ namespace Newtonsoft.Json
|
|||||||
/// <value>The schema.</value>
|
/// <value>The schema.</value>
|
||||||
public JsonSchema Schema
|
public JsonSchema Schema
|
||||||
{
|
{
|
||||||
get { return _schema; }
|
get => _schema;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (TokenType != JsonToken.None)
|
if (TokenType != JsonToken.None)
|
||||||
@@ -346,10 +319,7 @@ namespace Newtonsoft.Json
|
|||||||
/// Gets the <see cref="JsonReader"/> used to construct this <see cref="JsonValidatingReader"/>.
|
/// Gets the <see cref="JsonReader"/> used to construct this <see cref="JsonValidatingReader"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The <see cref="JsonReader"/> specified in the constructor.</value>
|
/// <value>The <see cref="JsonReader"/> specified in the constructor.</value>
|
||||||
public JsonReader Reader
|
public JsonReader Reader => _reader;
|
||||||
{
|
|
||||||
get { return _reader; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Changes the reader's state to <see cref="JsonReader.State.Closed"/>.
|
/// Changes the reader's state to <see cref="JsonReader.State.Closed"/>.
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Formatting Formatting
|
public Formatting Formatting
|
||||||
{
|
{
|
||||||
get { return _formatting; }
|
get => _formatting;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value < Formatting.None || value > Formatting.Indented)
|
if (value < Formatting.None || value > Formatting.Indented)
|
||||||
@@ -248,7 +248,7 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DateFormatHandling DateFormatHandling
|
public DateFormatHandling DateFormatHandling
|
||||||
{
|
{
|
||||||
get { return _dateFormatHandling; }
|
get => _dateFormatHandling;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value < DateFormatHandling.IsoDateFormat || value > DateFormatHandling.MicrosoftDateFormat)
|
if (value < DateFormatHandling.IsoDateFormat || value > DateFormatHandling.MicrosoftDateFormat)
|
||||||
@@ -265,7 +265,7 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTimeZoneHandling DateTimeZoneHandling
|
public DateTimeZoneHandling DateTimeZoneHandling
|
||||||
{
|
{
|
||||||
get { return _dateTimeZoneHandling; }
|
get => _dateTimeZoneHandling;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value < DateTimeZoneHandling.Local || value > DateTimeZoneHandling.RoundtripKind)
|
if (value < DateTimeZoneHandling.Local || value > DateTimeZoneHandling.RoundtripKind)
|
||||||
@@ -282,7 +282,7 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public StringEscapeHandling StringEscapeHandling
|
public StringEscapeHandling StringEscapeHandling
|
||||||
{
|
{
|
||||||
get { return _stringEscapeHandling; }
|
get => _stringEscapeHandling;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value < StringEscapeHandling.Default || value > StringEscapeHandling.EscapeHtml)
|
if (value < StringEscapeHandling.Default || value > StringEscapeHandling.EscapeHtml)
|
||||||
@@ -307,7 +307,7 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public FloatFormatHandling FloatFormatHandling
|
public FloatFormatHandling FloatFormatHandling
|
||||||
{
|
{
|
||||||
get { return _floatFormatHandling; }
|
get => _floatFormatHandling;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value < FloatFormatHandling.String || value > FloatFormatHandling.DefaultValue)
|
if (value < FloatFormatHandling.String || value > FloatFormatHandling.DefaultValue)
|
||||||
@@ -324,8 +324,8 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string DateFormatString
|
public string DateFormatString
|
||||||
{
|
{
|
||||||
get { return _dateFormatString; }
|
get => _dateFormatString;
|
||||||
set { _dateFormatString = value; }
|
set => _dateFormatString = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -333,8 +333,8 @@ namespace Newtonsoft.Json
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public CultureInfo Culture
|
public CultureInfo Culture
|
||||||
{
|
{
|
||||||
get { return _culture ?? CultureInfo.InvariantCulture; }
|
get => _culture ?? CultureInfo.InvariantCulture;
|
||||||
set { _culture = value; }
|
set => _culture = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -46,19 +46,13 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// Gets the container's children tokens.
|
/// Gets the container's children tokens.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The container's children tokens.</value>
|
/// <value>The container's children tokens.</value>
|
||||||
protected override IList<JToken> ChildrenTokens
|
protected override IList<JToken> ChildrenTokens => _values;
|
||||||
{
|
|
||||||
get { return _values; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the node type for this <see cref="JToken"/>.
|
/// Gets the node type for this <see cref="JToken"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The type.</value>
|
/// <value>The type.</value>
|
||||||
public override JTokenType Type
|
public override JTokenType Type => JTokenType.Array;
|
||||||
{
|
|
||||||
get { return JTokenType.Array; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="JArray"/> class.
|
/// Initializes a new instance of the <see cref="JArray"/> class.
|
||||||
@@ -266,8 +260,8 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// <value></value>
|
/// <value></value>
|
||||||
public JToken this[int index]
|
public JToken this[int index]
|
||||||
{
|
{
|
||||||
get { return GetItem(index); }
|
get => GetItem(index);
|
||||||
set { SetItem(index, value); }
|
set => SetItem(index, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override int IndexOfItem(JToken item)
|
internal override int IndexOfItem(JToken item)
|
||||||
@@ -382,10 +376,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// Gets a value indicating whether the <see cref="JArray"/> is read-only.
|
/// Gets a value indicating whether the <see cref="JArray"/> is read-only.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns><c>true</c> if the <see cref="JArray"/> is read-only; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if the <see cref="JArray"/> is read-only; otherwise, <c>false</c>.</returns>
|
||||||
public bool IsReadOnly
|
public bool IsReadOnly => false;
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes the first occurrence of a specific object from the <see cref="JArray"/>.
|
/// Removes the first occurrence of a specific object from the <see cref="JArray"/>.
|
||||||
|
|||||||
@@ -43,10 +43,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// Gets the container's children tokens.
|
/// Gets the container's children tokens.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The container's children tokens.</value>
|
/// <value>The container's children tokens.</value>
|
||||||
protected override IList<JToken> ChildrenTokens
|
protected override IList<JToken> ChildrenTokens => _values;
|
||||||
{
|
|
||||||
get { return _values; }
|
|
||||||
}
|
|
||||||
|
|
||||||
internal override int IndexOfItem(JToken item)
|
internal override int IndexOfItem(JToken item)
|
||||||
{
|
{
|
||||||
@@ -74,18 +71,15 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// <value>The constructor name.</value>
|
/// <value>The constructor name.</value>
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get { return _name; }
|
get => _name;
|
||||||
set { _name = value; }
|
set => _name = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the node type for this <see cref="JToken"/>.
|
/// Gets the node type for this <see cref="JToken"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The type.</value>
|
/// <value>The type.</value>
|
||||||
public override JTokenType Type
|
public override JTokenType Type => JTokenType.Constructor;
|
||||||
{
|
|
||||||
get { return JTokenType.Constructor; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="JConstructor"/> class.
|
/// Initializes a new instance of the <see cref="JConstructor"/> class.
|
||||||
|
|||||||
@@ -63,8 +63,8 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event ListChangedEventHandler ListChanged
|
public event ListChangedEventHandler ListChanged
|
||||||
{
|
{
|
||||||
add { _listChanged += value; }
|
add => _listChanged += value;
|
||||||
remove { _listChanged -= value; }
|
remove => _listChanged -= value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -72,8 +72,8 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event AddingNewEventHandler AddingNew
|
public event AddingNewEventHandler AddingNew
|
||||||
{
|
{
|
||||||
add { _addingNew += value; }
|
add => _addingNew += value;
|
||||||
remove { _addingNew -= value; }
|
remove => _addingNew -= value;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAVE_INOTIFY_COLLECTION_CHANGED
|
#if HAVE_INOTIFY_COLLECTION_CHANGED
|
||||||
@@ -194,10 +194,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// <value>
|
/// <value>
|
||||||
/// <c>true</c> if this token has child values; otherwise, <c>false</c>.
|
/// <c>true</c> if this token has child values; otherwise, <c>false</c>.
|
||||||
/// </value>
|
/// </value>
|
||||||
public override bool HasValues
|
public override bool HasValues => ChildrenTokens.Count > 0;
|
||||||
{
|
|
||||||
get { return ChildrenTokens.Count > 0; }
|
|
||||||
}
|
|
||||||
|
|
||||||
internal bool ContentsEqual(JContainer container)
|
internal bool ContentsEqual(JContainer container)
|
||||||
{
|
{
|
||||||
@@ -906,8 +903,8 @@ namespace Newtonsoft.Json.Linq
|
|||||||
|
|
||||||
JToken IList<JToken>.this[int index]
|
JToken IList<JToken>.this[int index]
|
||||||
{
|
{
|
||||||
get { return GetItem(index); }
|
get => GetItem(index);
|
||||||
set { SetItem(index, value); }
|
set => SetItem(index, value);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -932,10 +929,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
CopyItemsTo(array, arrayIndex);
|
CopyItemsTo(array, arrayIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ICollection<JToken>.IsReadOnly
|
bool ICollection<JToken>.IsReadOnly => false;
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ICollection<JToken>.Remove(JToken item)
|
bool ICollection<JToken>.Remove(JToken item)
|
||||||
{
|
{
|
||||||
@@ -986,15 +980,9 @@ namespace Newtonsoft.Json.Linq
|
|||||||
InsertItem(index, EnsureValue(value), false);
|
InsertItem(index, EnsureValue(value), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IList.IsFixedSize
|
bool IList.IsFixedSize => false;
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IList.IsReadOnly
|
bool IList.IsReadOnly => false;
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
void IList.Remove(object value)
|
void IList.Remove(object value)
|
||||||
{
|
{
|
||||||
@@ -1008,8 +996,8 @@ namespace Newtonsoft.Json.Linq
|
|||||||
|
|
||||||
object IList.this[int index]
|
object IList.this[int index]
|
||||||
{
|
{
|
||||||
get { return GetItem(index); }
|
get => GetItem(index);
|
||||||
set { SetItem(index, EnsureValue(value)); }
|
set => SetItem(index, EnsureValue(value));
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -1023,15 +1011,9 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// Gets the count of child JSON tokens.
|
/// Gets the count of child JSON tokens.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The count of child JSON tokens.</value>
|
/// <value>The count of child JSON tokens.</value>
|
||||||
public int Count
|
public int Count => ChildrenTokens.Count;
|
||||||
{
|
|
||||||
get { return ChildrenTokens.Count; }
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ICollection.IsSynchronized
|
bool ICollection.IsSynchronized => false;
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
object ICollection.SyncRoot
|
object ICollection.SyncRoot
|
||||||
{
|
{
|
||||||
@@ -1074,20 +1056,11 @@ namespace Newtonsoft.Json.Linq
|
|||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IBindingList.AllowEdit
|
bool IBindingList.AllowEdit => true;
|
||||||
{
|
|
||||||
get { return true; }
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IBindingList.AllowNew
|
bool IBindingList.AllowNew => true;
|
||||||
{
|
|
||||||
get { return true; }
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IBindingList.AllowRemove
|
bool IBindingList.AllowRemove => true;
|
||||||
{
|
|
||||||
get { return true; }
|
|
||||||
}
|
|
||||||
|
|
||||||
void IBindingList.ApplySort(PropertyDescriptor property, ListSortDirection direction)
|
void IBindingList.ApplySort(PropertyDescriptor property, ListSortDirection direction)
|
||||||
{
|
{
|
||||||
@@ -1099,10 +1072,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IBindingList.IsSorted
|
bool IBindingList.IsSorted => false;
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
void IBindingList.RemoveIndex(PropertyDescriptor property)
|
void IBindingList.RemoveIndex(PropertyDescriptor property)
|
||||||
{
|
{
|
||||||
@@ -1113,30 +1083,15 @@ namespace Newtonsoft.Json.Linq
|
|||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
ListSortDirection IBindingList.SortDirection
|
ListSortDirection IBindingList.SortDirection => ListSortDirection.Ascending;
|
||||||
{
|
|
||||||
get { return ListSortDirection.Ascending; }
|
|
||||||
}
|
|
||||||
|
|
||||||
PropertyDescriptor IBindingList.SortProperty
|
PropertyDescriptor IBindingList.SortProperty => null;
|
||||||
{
|
|
||||||
get { return null; }
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IBindingList.SupportsChangeNotification
|
bool IBindingList.SupportsChangeNotification => true;
|
||||||
{
|
|
||||||
get { return true; }
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IBindingList.SupportsSearching
|
bool IBindingList.SupportsSearching => false;
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IBindingList.SupportsSorting
|
bool IBindingList.SupportsSorting => false;
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -65,10 +65,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// Gets the container's children tokens.
|
/// Gets the container's children tokens.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The container's children tokens.</value>
|
/// <value>The container's children tokens.</value>
|
||||||
protected override IList<JToken> ChildrenTokens
|
protected override IList<JToken> ChildrenTokens => _properties;
|
||||||
{
|
|
||||||
get { return _properties; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when a property value changes.
|
/// Occurs when a property value changes.
|
||||||
@@ -237,10 +234,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// Gets the node type for this <see cref="JToken"/>.
|
/// Gets the node type for this <see cref="JToken"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The type.</value>
|
/// <value>The type.</value>
|
||||||
public override JTokenType Type
|
public override JTokenType Type => JTokenType.Object;
|
||||||
{
|
|
||||||
get { return JTokenType.Object; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets an <see cref="IEnumerable{T}"/> of <see cref="JProperty"/> of this object's properties.
|
/// Gets an <see cref="IEnumerable{T}"/> of <see cref="JProperty"/> of this object's properties.
|
||||||
@@ -558,11 +552,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
return _properties.Contains(key);
|
return _properties.Contains(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
ICollection<string> IDictionary<string, JToken>.Keys
|
ICollection<string> IDictionary<string, JToken>.Keys => _properties.Keys;
|
||||||
{
|
|
||||||
// todo: make order of the collection returned match JObject order
|
|
||||||
get { return _properties.Keys; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes the property with the specified name.
|
/// Removes the property with the specified name.
|
||||||
@@ -600,14 +590,8 @@ namespace Newtonsoft.Json.Linq
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ICollection<JToken> IDictionary<string, JToken>.Values
|
ICollection<JToken> IDictionary<string, JToken>.Values => throw new NotImplementedException();
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
// todo: need to wrap _properties.Values with a collection to get the JProperty value
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ICollection<KeyValuePair<string,JToken>> Members
|
#region ICollection<KeyValuePair<string,JToken>> Members
|
||||||
@@ -659,10 +643,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ICollection<KeyValuePair<string, JToken>>.IsReadOnly
|
bool ICollection<KeyValuePair<string, JToken>>.IsReadOnly => false;
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ICollection<KeyValuePair<string, JToken>>.Remove(KeyValuePair<string, JToken> item)
|
bool ICollection<KeyValuePair<string, JToken>>.Remove(KeyValuePair<string, JToken> item)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -88,15 +88,9 @@ namespace Newtonsoft.Json.Linq
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Count
|
public int Count => (_token != null) ? 1 : 0;
|
||||||
{
|
|
||||||
get { return (_token != null) ? 1 : 0; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsReadOnly
|
public bool IsReadOnly => false;
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int IndexOf(JToken item)
|
public int IndexOf(JToken item)
|
||||||
{
|
{
|
||||||
@@ -121,7 +115,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
|
|
||||||
public JToken this[int index]
|
public JToken this[int index]
|
||||||
{
|
{
|
||||||
get { return (index == 0) ? _token : null; }
|
get => (index == 0) ? _token : null;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
@@ -140,10 +134,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// Gets the container's children tokens.
|
/// Gets the container's children tokens.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The container's children tokens.</value>
|
/// <value>The container's children tokens.</value>
|
||||||
protected override IList<JToken> ChildrenTokens
|
protected override IList<JToken> ChildrenTokens => _content;
|
||||||
{
|
|
||||||
get { return _content; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the property name.
|
/// Gets the property name.
|
||||||
|
|||||||
@@ -115,10 +115,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// <see cref="PropertyDescriptor.SetValue(Object, Object)"/>
|
/// <see cref="PropertyDescriptor.SetValue(Object, Object)"/>
|
||||||
/// methods are invoked, the object specified might be an instance of this type.
|
/// methods are invoked, the object specified might be an instance of this type.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public override Type ComponentType
|
public override Type ComponentType => typeof(JObject);
|
||||||
{
|
|
||||||
get { return typeof(JObject); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When overridden in a derived class, gets a value indicating whether this property is read-only.
|
/// When overridden in a derived class, gets a value indicating whether this property is read-only.
|
||||||
@@ -126,10 +123,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// <c>true</c> if the property is read-only; otherwise, <c>false</c>.
|
/// <c>true</c> if the property is read-only; otherwise, <c>false</c>.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public override bool IsReadOnly
|
public override bool IsReadOnly => false;
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When overridden in a derived class, gets the type of the property.
|
/// When overridden in a derived class, gets the type of the property.
|
||||||
@@ -137,10 +131,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="Type"/> that represents the type of the property.
|
/// A <see cref="Type"/> that represents the type of the property.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public override Type PropertyType
|
public override Type PropertyType => typeof(object);
|
||||||
{
|
|
||||||
get { return typeof(object); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the hash code for the name of the member.
|
/// Gets the hash code for the name of the member.
|
||||||
|
|||||||
@@ -164,8 +164,8 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// <value>The <see cref="JToken"/> that contains the next sibling token.</value>
|
/// <value>The <see cref="JToken"/> that contains the next sibling token.</value>
|
||||||
public JToken Next
|
public JToken Next
|
||||||
{
|
{
|
||||||
get { return _next; }
|
get => _next;
|
||||||
internal set { _next = value; }
|
internal set => _next = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -174,8 +174,8 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// <value>The <see cref="JToken"/> that contains the previous sibling token.</value>
|
/// <value>The <see cref="JToken"/> that contains the previous sibling token.</value>
|
||||||
public JToken Previous
|
public JToken Previous
|
||||||
{
|
{
|
||||||
get { return _previous; }
|
get => _previous;
|
||||||
internal set { _previous = value; }
|
internal set => _previous = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -319,8 +319,8 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// <value>The <see cref="JToken"/> with the specified key.</value>
|
/// <value>The <see cref="JToken"/> with the specified key.</value>
|
||||||
public virtual JToken this[object key]
|
public virtual JToken this[object key]
|
||||||
{
|
{
|
||||||
get { throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType())); }
|
get => throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType()));
|
||||||
set { throw new InvalidOperationException("Cannot set child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType())); }
|
set => throw new InvalidOperationException("Cannot set child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -341,19 +341,13 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// Get the first child token of this token.
|
/// Get the first child token of this token.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>A <see cref="JToken"/> containing the first child token of the <see cref="JToken"/>.</value>
|
/// <value>A <see cref="JToken"/> containing the first child token of the <see cref="JToken"/>.</value>
|
||||||
public virtual JToken First
|
public virtual JToken First => throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType()));
|
||||||
{
|
|
||||||
get { throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType())); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the last child token of this token.
|
/// Get the last child token of this token.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>A <see cref="JToken"/> containing the last child token of the <see cref="JToken"/>.</value>
|
/// <value>A <see cref="JToken"/> containing the last child token of the <see cref="JToken"/>.</value>
|
||||||
public virtual JToken Last
|
public virtual JToken Last => throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType()));
|
||||||
{
|
|
||||||
get { throw new InvalidOperationException("Cannot access child value on {0}.".FormatWith(CultureInfo.InvariantCulture, GetType())); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a collection of the child tokens of this token, in document order.
|
/// Returns a collection of the child tokens of this token, in document order.
|
||||||
@@ -1879,10 +1873,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
|
|
||||||
internal abstract int GetDeepHashCode();
|
internal abstract int GetDeepHashCode();
|
||||||
|
|
||||||
IJEnumerable<JToken> IJEnumerable<JToken>.this[object key]
|
IJEnumerable<JToken> IJEnumerable<JToken>.this[object key] => this[key];
|
||||||
{
|
|
||||||
get { return this[key]; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a <see cref="JsonReader"/> for this token.
|
/// Creates a <see cref="JsonReader"/> for this token.
|
||||||
|
|||||||
@@ -41,10 +41,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the <see cref="JToken"/> at the reader's current position.
|
/// Gets the <see cref="JToken"/> at the reader's current position.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public JToken CurrentToken
|
public JToken CurrentToken => _current;
|
||||||
{
|
|
||||||
get { return _current; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="JTokenReader"/> class.
|
/// Initializes a new instance of the <see cref="JTokenReader"/> class.
|
||||||
|
|||||||
@@ -46,10 +46,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the <see cref="JToken"/> at the writer's current position.
|
/// Gets the <see cref="JToken"/> at the writer's current position.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public JToken CurrentToken
|
public JToken CurrentToken => _current;
|
||||||
{
|
|
||||||
get { return _current; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the token being written.
|
/// Gets the token being written.
|
||||||
|
|||||||
@@ -214,10 +214,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// <value>
|
/// <value>
|
||||||
/// <c>true</c> if this token has child values; otherwise, <c>false</c>.
|
/// <c>true</c> if this token has child values; otherwise, <c>false</c>.
|
||||||
/// </value>
|
/// </value>
|
||||||
public override bool HasValues
|
public override bool HasValues => false;
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#if HAVE_BIG_INTEGER
|
#if HAVE_BIG_INTEGER
|
||||||
private static int CompareBigInteger(BigInteger i1, object i2)
|
private static int CompareBigInteger(BigInteger i1, object i2)
|
||||||
@@ -695,10 +692,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// Gets the node type for this <see cref="JToken"/>.
|
/// Gets the node type for this <see cref="JToken"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The type.</value>
|
/// <value>The type.</value>
|
||||||
public override JTokenType Type
|
public override JTokenType Type => _valueType;
|
||||||
{
|
|
||||||
get { return _valueType; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the underlying token value.
|
/// Gets or sets the underlying token value.
|
||||||
@@ -706,7 +700,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// <value>The underlying token value.</value>
|
/// <value>The underlying token value.</value>
|
||||||
public object Value
|
public object Value
|
||||||
{
|
{
|
||||||
get { return _value; }
|
get => _value;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
Type currentType = _value?.GetType();
|
Type currentType = _value?.GetType();
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// <value>The JSON comment handling.</value>
|
/// <value>The JSON comment handling.</value>
|
||||||
public CommentHandling CommentHandling
|
public CommentHandling CommentHandling
|
||||||
{
|
{
|
||||||
get { return _commentHandling; }
|
get => _commentHandling;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value < CommentHandling.Ignore || value > CommentHandling.Load)
|
if (value < CommentHandling.Ignore || value > CommentHandling.Load)
|
||||||
@@ -43,7 +43,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// <value>The JSON line info handling.</value>
|
/// <value>The JSON line info handling.</value>
|
||||||
public LineInfoHandling LineInfoHandling
|
public LineInfoHandling LineInfoHandling
|
||||||
{
|
{
|
||||||
get { return _lineInfoHandling; }
|
get => _lineInfoHandling;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value < LineInfoHandling.Ignore || value > LineInfoHandling.Load)
|
if (value < LineInfoHandling.Ignore || value > LineInfoHandling.Load)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// <value>The method used when merging JSON arrays.</value>
|
/// <value>The method used when merging JSON arrays.</value>
|
||||||
public MergeArrayHandling MergeArrayHandling
|
public MergeArrayHandling MergeArrayHandling
|
||||||
{
|
{
|
||||||
get { return _mergeArrayHandling; }
|
get => _mergeArrayHandling;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value < MergeArrayHandling.Concat || value > MergeArrayHandling.Merge)
|
if (value < MergeArrayHandling.Concat || value > MergeArrayHandling.Merge)
|
||||||
@@ -34,7 +34,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// <value>How null value properties are merged.</value>
|
/// <value>How null value properties are merged.</value>
|
||||||
public MergeNullValueHandling MergeNullValueHandling
|
public MergeNullValueHandling MergeNullValueHandling
|
||||||
{
|
{
|
||||||
get { return _mergeNullValueHandling; }
|
get => _mergeNullValueHandling;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value < MergeNullValueHandling.Ignore || value > MergeNullValueHandling.Merge)
|
if (value < MergeNullValueHandling.Ignore || value > MergeNullValueHandling.Merge)
|
||||||
|
|||||||
@@ -243,10 +243,7 @@ namespace Newtonsoft.Json.Schema
|
|||||||
|
|
||||||
private readonly string _internalId = Guid.NewGuid().ToString("N");
|
private readonly string _internalId = Guid.NewGuid().ToString("N");
|
||||||
|
|
||||||
internal string InternalId
|
internal string InternalId => _internalId;
|
||||||
{
|
|
||||||
get { return _internalId; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// if this is set then this schema instance is just a deferred reference
|
// if this is set then this schema instance is just a deferred reference
|
||||||
// and will be replaced when the schema reference is resolved
|
// and will be replaced when the schema reference is resolved
|
||||||
|
|||||||
@@ -70,10 +70,7 @@ namespace Newtonsoft.Json.Schema
|
|||||||
return poppedSchema;
|
return poppedSchema;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JsonSchema CurrentSchema
|
private JsonSchema CurrentSchema => _currentSchema;
|
||||||
{
|
|
||||||
get { return _currentSchema; }
|
|
||||||
}
|
|
||||||
|
|
||||||
internal JsonSchema Read(JsonReader reader)
|
internal JsonSchema Read(JsonReader reader)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ namespace Newtonsoft.Json.Schema
|
|||||||
|
|
||||||
return _contractResolver;
|
return _contractResolver;
|
||||||
}
|
}
|
||||||
set { _contractResolver = value; }
|
set => _contractResolver = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TypeSchema
|
private class TypeSchema
|
||||||
@@ -94,10 +94,7 @@ namespace Newtonsoft.Json.Schema
|
|||||||
private readonly IList<TypeSchema> _stack = new List<TypeSchema>();
|
private readonly IList<TypeSchema> _stack = new List<TypeSchema>();
|
||||||
private JsonSchema _currentSchema;
|
private JsonSchema _currentSchema;
|
||||||
|
|
||||||
private JsonSchema CurrentSchema
|
private JsonSchema CurrentSchema => _currentSchema;
|
||||||
{
|
|
||||||
get { return _currentSchema; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Push(TypeSchema typeSchema)
|
private void Push(TypeSchema typeSchema)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,27 +51,18 @@ namespace Newtonsoft.Json.Schema
|
|||||||
/// Gets the <see cref="JsonSchemaException"/> associated with the validation error.
|
/// Gets the <see cref="JsonSchemaException"/> associated with the validation error.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The JsonSchemaException associated with the validation error.</value>
|
/// <value>The JsonSchemaException associated with the validation error.</value>
|
||||||
public JsonSchemaException Exception
|
public JsonSchemaException Exception => _ex;
|
||||||
{
|
|
||||||
get { return _ex; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path of the JSON location where the validation error occurred.
|
/// Gets the path of the JSON location where the validation error occurred.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The path of the JSON location where the validation error occurred.</value>
|
/// <value>The path of the JSON location where the validation error occurred.</value>
|
||||||
public string Path
|
public string Path => _ex.Path;
|
||||||
{
|
|
||||||
get { return _ex.Path; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the text description corresponding to the validation error.
|
/// Gets the text description corresponding to the validation error.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The text description.</value>
|
/// <value>The text description.</value>
|
||||||
public string Message
|
public string Message => _ex.Message;
|
||||||
{
|
|
||||||
get { return _ex.Message; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,10 +62,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
private static readonly IContractResolver _instance = new DefaultContractResolver();
|
private static readonly IContractResolver _instance = new DefaultContractResolver();
|
||||||
|
|
||||||
// Json.NET Schema requires a property
|
// Json.NET Schema requires a property
|
||||||
internal static IContractResolver Instance
|
internal static IContractResolver Instance => _instance;
|
||||||
{
|
|
||||||
get { return _instance; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private static readonly JsonConverter[] BuiltInConverters =
|
private static readonly JsonConverter[] BuiltInConverters =
|
||||||
{
|
{
|
||||||
@@ -104,10 +101,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
/// <value>
|
/// <value>
|
||||||
/// <c>true</c> if using dynamic code generation; otherwise, <c>false</c>.
|
/// <c>true</c> if using dynamic code generation; otherwise, <c>false</c>.
|
||||||
/// </value>
|
/// </value>
|
||||||
public bool DynamicCodeGeneration
|
public bool DynamicCodeGeneration => JsonTypeReflector.DynamicCodeGeneration;
|
||||||
{
|
|
||||||
get { return JsonTypeReflector.DynamicCodeGeneration; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !PORTABLE
|
#if !PORTABLE
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
/// <value>The function used to create the object.</value>
|
/// <value>The function used to create the object.</value>
|
||||||
public ObjectConstructor<object> OverrideCreator
|
public ObjectConstructor<object> OverrideCreator
|
||||||
{
|
{
|
||||||
get { return _overrideCreator; }
|
get => _overrideCreator;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_overrideCreator = value;
|
_overrideCreator = value;
|
||||||
@@ -106,10 +106,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
/// <value><c>true</c> if the creator has a parameter with the collection values; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if the creator has a parameter with the collection values; otherwise, <c>false</c>.</value>
|
||||||
public bool HasParameterizedCreator { get; set; }
|
public bool HasParameterizedCreator { get; set; }
|
||||||
|
|
||||||
internal bool HasParameterizedCreatorInternal
|
internal bool HasParameterizedCreatorInternal => (HasParameterizedCreator || _parameterizedCreator != null || _parameterizedConstructor != null);
|
||||||
{
|
|
||||||
get { return (HasParameterizedCreator || _parameterizedCreator != null || _parameterizedConstructor != null); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="JsonArrayContract"/> class.
|
/// Initializes a new instance of the <see cref="JsonArrayContract"/> class.
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
// will be null for containers that don't have an item type (e.g. IList) or for complex objects
|
// will be null for containers that don't have an item type (e.g. IList) or for complex objects
|
||||||
internal JsonContract ItemContract
|
internal JsonContract ItemContract
|
||||||
{
|
{
|
||||||
get { return _itemContract; }
|
get => _itemContract;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_itemContract = value;
|
_itemContract = value;
|
||||||
@@ -64,10 +64,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
}
|
}
|
||||||
|
|
||||||
// the final (i.e. can't be inherited from like a sealed class or valuetype) item contract
|
// the final (i.e. can't be inherited from like a sealed class or valuetype) item contract
|
||||||
internal JsonContract FinalItemContract
|
internal JsonContract FinalItemContract => _finalItemContract;
|
||||||
{
|
|
||||||
get { return _finalItemContract; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the default collection items <see cref="JsonConverter" />.
|
/// Gets or sets the default collection items <see cref="JsonConverter" />.
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
/// <value>The type created during deserialization.</value>
|
/// <value>The type created during deserialization.</value>
|
||||||
public Type CreatedType
|
public Type CreatedType
|
||||||
{
|
{
|
||||||
get { return _createdType; }
|
get => _createdType;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_createdType = value;
|
_createdType = value;
|
||||||
|
|||||||
@@ -94,8 +94,8 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
/// <value>The function used to create the object.</value>
|
/// <value>The function used to create the object.</value>
|
||||||
public ObjectConstructor<object> OverrideCreator
|
public ObjectConstructor<object> OverrideCreator
|
||||||
{
|
{
|
||||||
get { return _overrideCreator; }
|
get => _overrideCreator;
|
||||||
set { _overrideCreator = value; }
|
set => _overrideCreator = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -104,10 +104,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
/// <value><c>true</c> if the creator has a parameter with the dictionary values; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if the creator has a parameter with the dictionary values; otherwise, <c>false</c>.</value>
|
||||||
public bool HasParameterizedCreator { get; set; }
|
public bool HasParameterizedCreator { get; set; }
|
||||||
|
|
||||||
internal bool HasParameterizedCreatorInternal
|
internal bool HasParameterizedCreatorInternal => (HasParameterizedCreator || _parameterizedCreator != null || _parameterizedConstructor != null);
|
||||||
{
|
|
||||||
get { return (HasParameterizedCreator || _parameterizedCreator != null || _parameterizedConstructor != null); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="JsonDictionaryContract"/> class.
|
/// Initializes a new instance of the <see cref="JsonDictionaryContract"/> class.
|
||||||
|
|||||||
@@ -81,14 +81,14 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
/// <value>The function used to create the object.</value>
|
/// <value>The function used to create the object.</value>
|
||||||
public ObjectConstructor<object> OverrideCreator
|
public ObjectConstructor<object> OverrideCreator
|
||||||
{
|
{
|
||||||
get { return _overrideCreator; }
|
get => _overrideCreator;
|
||||||
set { _overrideCreator = value; }
|
set => _overrideCreator = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal ObjectConstructor<object> ParameterizedCreator
|
internal ObjectConstructor<object> ParameterizedCreator
|
||||||
{
|
{
|
||||||
get { return _parameterizedCreator; }
|
get => _parameterizedCreator;
|
||||||
set { _parameterizedCreator = value; }
|
set => _parameterizedCreator = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -106,7 +106,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Type ExtensionDataValueType
|
public Type ExtensionDataValueType
|
||||||
{
|
{
|
||||||
get { return _extensionDataValueType; }
|
get => _extensionDataValueType;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_extensionDataValueType = value;
|
_extensionDataValueType = value;
|
||||||
|
|||||||
@@ -48,8 +48,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
TypeCode = ConvertUtils.GetTypeCode(underlyingType);
|
TypeCode = ConvertUtils.GetTypeCode(underlyingType);
|
||||||
IsReadOnlyOrFixedSize = true;
|
IsReadOnlyOrFixedSize = true;
|
||||||
|
|
||||||
ReadType readType;
|
if (ReadTypeMap.TryGetValue(NonNullableUnderlyingType, out ReadType readType))
|
||||||
if (ReadTypeMap.TryGetValue(NonNullableUnderlyingType, out readType))
|
|
||||||
{
|
{
|
||||||
InternalReadType = readType;
|
InternalReadType = readType;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
/// <value>The name of the property.</value>
|
/// <value>The name of the property.</value>
|
||||||
public string PropertyName
|
public string PropertyName
|
||||||
{
|
{
|
||||||
get { return _propertyName; }
|
get => _propertyName;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_propertyName = value;
|
_propertyName = value;
|
||||||
@@ -100,7 +100,7 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
/// <value>The type of the property.</value>
|
/// <value>The type of the property.</value>
|
||||||
public Type PropertyType
|
public Type PropertyType
|
||||||
{
|
{
|
||||||
get { return _propertyType; }
|
get => _propertyType;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_propertyType != value)
|
if (_propertyType != value)
|
||||||
@@ -125,8 +125,8 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
[Obsolete("MemberConverter is obsolete. Use Converter instead.")]
|
[Obsolete("MemberConverter is obsolete. Use Converter instead.")]
|
||||||
public JsonConverter MemberConverter
|
public JsonConverter MemberConverter
|
||||||
{
|
{
|
||||||
get { return Converter; }
|
get => Converter;
|
||||||
set { Converter = value; }
|
set => Converter = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -197,8 +197,8 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
/// <value>A value indicating whether this <see cref="JsonProperty"/> is required.</value>
|
/// <value>A value indicating whether this <see cref="JsonProperty"/> is required.</value>
|
||||||
public Required Required
|
public Required Required
|
||||||
{
|
{
|
||||||
get { return _required ?? Required.Default; }
|
get => _required ?? Required.Default;
|
||||||
set { _required = value; }
|
set => _required = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -40,189 +40,186 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
|
|
||||||
public override event EventHandler<ErrorEventArgs> Error
|
public override event EventHandler<ErrorEventArgs> Error
|
||||||
{
|
{
|
||||||
add { _serializer.Error += value; }
|
add => _serializer.Error += value;
|
||||||
remove { _serializer.Error -= value; }
|
remove => _serializer.Error -= value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IReferenceResolver ReferenceResolver
|
public override IReferenceResolver ReferenceResolver
|
||||||
{
|
{
|
||||||
get { return _serializer.ReferenceResolver; }
|
get => _serializer.ReferenceResolver;
|
||||||
set { _serializer.ReferenceResolver = value; }
|
set => _serializer.ReferenceResolver = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ITraceWriter TraceWriter
|
public override ITraceWriter TraceWriter
|
||||||
{
|
{
|
||||||
get { return _serializer.TraceWriter; }
|
get => _serializer.TraceWriter;
|
||||||
set { _serializer.TraceWriter = value; }
|
set => _serializer.TraceWriter = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEqualityComparer EqualityComparer
|
public override IEqualityComparer EqualityComparer
|
||||||
{
|
{
|
||||||
get { return _serializer.EqualityComparer; }
|
get => _serializer.EqualityComparer;
|
||||||
set { _serializer.EqualityComparer = value; }
|
set => _serializer.EqualityComparer = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override JsonConverterCollection Converters
|
public override JsonConverterCollection Converters => _serializer.Converters;
|
||||||
{
|
|
||||||
get { return _serializer.Converters; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override DefaultValueHandling DefaultValueHandling
|
public override DefaultValueHandling DefaultValueHandling
|
||||||
{
|
{
|
||||||
get { return _serializer.DefaultValueHandling; }
|
get => _serializer.DefaultValueHandling;
|
||||||
set { _serializer.DefaultValueHandling = value; }
|
set => _serializer.DefaultValueHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IContractResolver ContractResolver
|
public override IContractResolver ContractResolver
|
||||||
{
|
{
|
||||||
get { return _serializer.ContractResolver; }
|
get => _serializer.ContractResolver;
|
||||||
set { _serializer.ContractResolver = value; }
|
set => _serializer.ContractResolver = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override MissingMemberHandling MissingMemberHandling
|
public override MissingMemberHandling MissingMemberHandling
|
||||||
{
|
{
|
||||||
get { return _serializer.MissingMemberHandling; }
|
get => _serializer.MissingMemberHandling;
|
||||||
set { _serializer.MissingMemberHandling = value; }
|
set => _serializer.MissingMemberHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override NullValueHandling NullValueHandling
|
public override NullValueHandling NullValueHandling
|
||||||
{
|
{
|
||||||
get { return _serializer.NullValueHandling; }
|
get => _serializer.NullValueHandling;
|
||||||
set { _serializer.NullValueHandling = value; }
|
set => _serializer.NullValueHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ObjectCreationHandling ObjectCreationHandling
|
public override ObjectCreationHandling ObjectCreationHandling
|
||||||
{
|
{
|
||||||
get { return _serializer.ObjectCreationHandling; }
|
get => _serializer.ObjectCreationHandling;
|
||||||
set { _serializer.ObjectCreationHandling = value; }
|
set => _serializer.ObjectCreationHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ReferenceLoopHandling ReferenceLoopHandling
|
public override ReferenceLoopHandling ReferenceLoopHandling
|
||||||
{
|
{
|
||||||
get { return _serializer.ReferenceLoopHandling; }
|
get => _serializer.ReferenceLoopHandling;
|
||||||
set { _serializer.ReferenceLoopHandling = value; }
|
set => _serializer.ReferenceLoopHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PreserveReferencesHandling PreserveReferencesHandling
|
public override PreserveReferencesHandling PreserveReferencesHandling
|
||||||
{
|
{
|
||||||
get { return _serializer.PreserveReferencesHandling; }
|
get => _serializer.PreserveReferencesHandling;
|
||||||
set { _serializer.PreserveReferencesHandling = value; }
|
set => _serializer.PreserveReferencesHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override TypeNameHandling TypeNameHandling
|
public override TypeNameHandling TypeNameHandling
|
||||||
{
|
{
|
||||||
get { return _serializer.TypeNameHandling; }
|
get => _serializer.TypeNameHandling;
|
||||||
set { _serializer.TypeNameHandling = value; }
|
set => _serializer.TypeNameHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override MetadataPropertyHandling MetadataPropertyHandling
|
public override MetadataPropertyHandling MetadataPropertyHandling
|
||||||
{
|
{
|
||||||
get { return _serializer.MetadataPropertyHandling; }
|
get => _serializer.MetadataPropertyHandling;
|
||||||
set { _serializer.MetadataPropertyHandling = value; }
|
set => _serializer.MetadataPropertyHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete("TypeNameAssemblyFormat is obsolete. Use TypeNameAssemblyFormatHandling instead.")]
|
[Obsolete("TypeNameAssemblyFormat is obsolete. Use TypeNameAssemblyFormatHandling instead.")]
|
||||||
public override FormatterAssemblyStyle TypeNameAssemblyFormat
|
public override FormatterAssemblyStyle TypeNameAssemblyFormat
|
||||||
{
|
{
|
||||||
get { return _serializer.TypeNameAssemblyFormat; }
|
get => _serializer.TypeNameAssemblyFormat;
|
||||||
set { _serializer.TypeNameAssemblyFormat = value; }
|
set => _serializer.TypeNameAssemblyFormat = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override TypeNameAssemblyFormatHandling TypeNameAssemblyFormatHandling
|
public override TypeNameAssemblyFormatHandling TypeNameAssemblyFormatHandling
|
||||||
{
|
{
|
||||||
get { return _serializer.TypeNameAssemblyFormatHandling; }
|
get => _serializer.TypeNameAssemblyFormatHandling;
|
||||||
set { _serializer.TypeNameAssemblyFormatHandling = value; }
|
set => _serializer.TypeNameAssemblyFormatHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ConstructorHandling ConstructorHandling
|
public override ConstructorHandling ConstructorHandling
|
||||||
{
|
{
|
||||||
get { return _serializer.ConstructorHandling; }
|
get => _serializer.ConstructorHandling;
|
||||||
set { _serializer.ConstructorHandling = value; }
|
set => _serializer.ConstructorHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete("Binder is obsolete. Use SerializationBinder instead.")]
|
[Obsolete("Binder is obsolete. Use SerializationBinder instead.")]
|
||||||
public override SerializationBinder Binder
|
public override SerializationBinder Binder
|
||||||
{
|
{
|
||||||
get { return _serializer.Binder; }
|
get => _serializer.Binder;
|
||||||
set { _serializer.Binder = value; }
|
set => _serializer.Binder = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ISerializationBinder SerializationBinder
|
public override ISerializationBinder SerializationBinder
|
||||||
{
|
{
|
||||||
get { return _serializer.SerializationBinder; }
|
get => _serializer.SerializationBinder;
|
||||||
set { _serializer.SerializationBinder = value; }
|
set => _serializer.SerializationBinder = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override StreamingContext Context
|
public override StreamingContext Context
|
||||||
{
|
{
|
||||||
get { return _serializer.Context; }
|
get => _serializer.Context;
|
||||||
set { _serializer.Context = value; }
|
set => _serializer.Context = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Formatting Formatting
|
public override Formatting Formatting
|
||||||
{
|
{
|
||||||
get { return _serializer.Formatting; }
|
get => _serializer.Formatting;
|
||||||
set { _serializer.Formatting = value; }
|
set => _serializer.Formatting = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override DateFormatHandling DateFormatHandling
|
public override DateFormatHandling DateFormatHandling
|
||||||
{
|
{
|
||||||
get { return _serializer.DateFormatHandling; }
|
get => _serializer.DateFormatHandling;
|
||||||
set { _serializer.DateFormatHandling = value; }
|
set => _serializer.DateFormatHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override DateTimeZoneHandling DateTimeZoneHandling
|
public override DateTimeZoneHandling DateTimeZoneHandling
|
||||||
{
|
{
|
||||||
get { return _serializer.DateTimeZoneHandling; }
|
get => _serializer.DateTimeZoneHandling;
|
||||||
set { _serializer.DateTimeZoneHandling = value; }
|
set => _serializer.DateTimeZoneHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override DateParseHandling DateParseHandling
|
public override DateParseHandling DateParseHandling
|
||||||
{
|
{
|
||||||
get { return _serializer.DateParseHandling; }
|
get => _serializer.DateParseHandling;
|
||||||
set { _serializer.DateParseHandling = value; }
|
set => _serializer.DateParseHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override FloatFormatHandling FloatFormatHandling
|
public override FloatFormatHandling FloatFormatHandling
|
||||||
{
|
{
|
||||||
get { return _serializer.FloatFormatHandling; }
|
get => _serializer.FloatFormatHandling;
|
||||||
set { _serializer.FloatFormatHandling = value; }
|
set => _serializer.FloatFormatHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override FloatParseHandling FloatParseHandling
|
public override FloatParseHandling FloatParseHandling
|
||||||
{
|
{
|
||||||
get { return _serializer.FloatParseHandling; }
|
get => _serializer.FloatParseHandling;
|
||||||
set { _serializer.FloatParseHandling = value; }
|
set => _serializer.FloatParseHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override StringEscapeHandling StringEscapeHandling
|
public override StringEscapeHandling StringEscapeHandling
|
||||||
{
|
{
|
||||||
get { return _serializer.StringEscapeHandling; }
|
get => _serializer.StringEscapeHandling;
|
||||||
set { _serializer.StringEscapeHandling = value; }
|
set => _serializer.StringEscapeHandling = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string DateFormatString
|
public override string DateFormatString
|
||||||
{
|
{
|
||||||
get { return _serializer.DateFormatString; }
|
get => _serializer.DateFormatString;
|
||||||
set { _serializer.DateFormatString = value; }
|
set => _serializer.DateFormatString = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override CultureInfo Culture
|
public override CultureInfo Culture
|
||||||
{
|
{
|
||||||
get { return _serializer.Culture; }
|
get => _serializer.Culture;
|
||||||
set { _serializer.Culture = value; }
|
set => _serializer.Culture = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int? MaxDepth
|
public override int? MaxDepth
|
||||||
{
|
{
|
||||||
get { return _serializer.MaxDepth; }
|
get => _serializer.MaxDepth;
|
||||||
set { _serializer.MaxDepth = value; }
|
set => _serializer.MaxDepth = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CheckAdditionalContent
|
public override bool CheckAdditionalContent
|
||||||
{
|
{
|
||||||
get { return _serializer.CheckAdditionalContent; }
|
get => _serializer.CheckAdditionalContent;
|
||||||
set { _serializer.CheckAdditionalContent = value; }
|
set => _serializer.CheckAdditionalContent = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal JsonSerializerInternalBase GetInternalSerializer()
|
internal JsonSerializerInternalBase GetInternalSerializer()
|
||||||
|
|||||||
@@ -99,36 +99,21 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
_textWriter.WriteToken(_innerReader, false, false, true);
|
_textWriter.WriteToken(_innerReader, false, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int Depth
|
public override int Depth => _innerReader.Depth;
|
||||||
{
|
|
||||||
get { return _innerReader.Depth; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string Path
|
public override string Path => _innerReader.Path;
|
||||||
{
|
|
||||||
get { return _innerReader.Path; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override char QuoteChar
|
public override char QuoteChar
|
||||||
{
|
{
|
||||||
get { return _innerReader.QuoteChar; }
|
get => _innerReader.QuoteChar;
|
||||||
protected internal set { _innerReader.QuoteChar = value; }
|
protected internal set => _innerReader.QuoteChar = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override JsonToken TokenType
|
public override JsonToken TokenType => _innerReader.TokenType;
|
||||||
{
|
|
||||||
get { return _innerReader.TokenType; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override object Value
|
public override object Value => _innerReader.Value;
|
||||||
{
|
|
||||||
get { return _innerReader.Value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Type ValueType
|
public override Type ValueType => _innerReader.ValueType;
|
||||||
{
|
|
||||||
get { return _innerReader.ValueType; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Close()
|
public override void Close()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -283,10 +283,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
CopyTo((T[])array, arrayIndex);
|
CopyTo((T[])array, arrayIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ICollection.IsSynchronized
|
bool ICollection.IsSynchronized => false;
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
object ICollection.SyncRoot
|
object ICollection.SyncRoot
|
||||||
{
|
{
|
||||||
@@ -319,9 +316,6 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public object UnderlyingCollection
|
public object UnderlyingCollection => (object)_genericCollection ?? _list;
|
||||||
{
|
|
||||||
get { return (object)_genericCollection ?? _list; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -492,25 +492,13 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
_e = e;
|
_e = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DictionaryEntry Entry
|
public DictionaryEntry Entry => (DictionaryEntry)Current;
|
||||||
{
|
|
||||||
get { return (DictionaryEntry)Current; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public object Key
|
public object Key => Entry.Key;
|
||||||
{
|
|
||||||
get { return Entry.Key; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public object Value
|
public object Value => Entry.Value;
|
||||||
{
|
|
||||||
get { return Entry.Value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public object Current
|
public object Current => new DictionaryEntry(_e.Current.Key, _e.Current.Value);
|
||||||
{
|
|
||||||
get { return new DictionaryEntry(_e.Current.Key, _e.Current.Value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext()
|
public bool MoveNext()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,10 +40,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
private static readonly DynamicReflectionDelegateFactory _instance = new DynamicReflectionDelegateFactory();
|
private static readonly DynamicReflectionDelegateFactory _instance = new DynamicReflectionDelegateFactory();
|
||||||
|
|
||||||
internal static DynamicReflectionDelegateFactory Instance
|
internal static DynamicReflectionDelegateFactory Instance => _instance;
|
||||||
{
|
|
||||||
get { return _instance; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private static DynamicMethod CreateDynamicMethod(string name, Type returnType, Type[] parameterTypes, Type owner)
|
private static DynamicMethod CreateDynamicMethod(string name, Type returnType, Type[] parameterTypes, Type owner)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,15 +30,9 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
private readonly string _name;
|
private readonly string _name;
|
||||||
private readonly T _value;
|
private readonly T _value;
|
||||||
|
|
||||||
public string Name
|
public string Name => _name;
|
||||||
{
|
|
||||||
get { return _name; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public T Value
|
public T Value => _value;
|
||||||
{
|
|
||||||
get { return _value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public EnumValue(string name, T value)
|
public EnumValue(string name, T value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,10 +37,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
{
|
{
|
||||||
private static readonly LateBoundReflectionDelegateFactory _instance = new LateBoundReflectionDelegateFactory();
|
private static readonly LateBoundReflectionDelegateFactory _instance = new LateBoundReflectionDelegateFactory();
|
||||||
|
|
||||||
internal static ReflectionDelegateFactory Instance
|
internal static ReflectionDelegateFactory Instance => _instance;
|
||||||
{
|
|
||||||
get { return _instance; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override ObjectConstructor<object> CreateParameterizedConstructor(MethodBase method)
|
public override ObjectConstructor<object> CreateParameterizedConstructor(MethodBase method)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2832,12 +2832,9 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
|
|||||||
/// Gets the number of key/value collection pairs in the <see cref="Lookup{TKey,TElement}" />.
|
/// Gets the number of key/value collection pairs in the <see cref="Lookup{TKey,TElement}" />.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
public int Count
|
public int Count => _map.Count;
|
||||||
{
|
|
||||||
get { return _map.Count; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the collection of values indexed by the specified key.
|
/// Gets the collection of values indexed by the specified key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
|
|||||||
@@ -37,14 +37,11 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
|
|
||||||
public int Position
|
public int Position
|
||||||
{
|
{
|
||||||
get { return _position; }
|
get => _position;
|
||||||
set { _position = value; }
|
set => _position = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsEmpty
|
public bool IsEmpty => _buffer == null;
|
||||||
{
|
|
||||||
get { return _buffer == null; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public StringBuffer(IArrayPool<char> bufferPool, int initalSize) : this(BufferUtils.RentBuffer(bufferPool, initalSize))
|
public StringBuffer(IArrayPool<char> bufferPool, int initalSize) : this(BufferUtils.RentBuffer(bufferPool, initalSize))
|
||||||
{
|
{
|
||||||
@@ -114,9 +111,6 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
return new string(_buffer, start, length);
|
return new string(_buffer, start, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public char[] InternalBuffer
|
public char[] InternalBuffer => _buffer;
|
||||||
{
|
|
||||||
get { return _buffer; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,25 +33,13 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
private readonly int _startIndex;
|
private readonly int _startIndex;
|
||||||
private readonly int _length;
|
private readonly int _length;
|
||||||
|
|
||||||
public char this[int i]
|
public char this[int i] => _chars[i];
|
||||||
{
|
|
||||||
get { return _chars[i]; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public char[] Chars
|
public char[] Chars => _chars;
|
||||||
{
|
|
||||||
get { return _chars; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int StartIndex
|
public int StartIndex => _startIndex;
|
||||||
{
|
|
||||||
get { return _startIndex; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Length
|
public int Length => _length;
|
||||||
{
|
|
||||||
get { return _length; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public StringReference(char[] chars, int startIndex, int length)
|
public StringReference(char[] chars, int startIndex, int length)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user