-Refactor to expression body properties

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