Skip to content

Commit

Permalink
-Refactor to expression body properties
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNK committed Oct 22, 2017
1 parent ef18269 commit 9932155
Show file tree
Hide file tree
Showing 50 changed files with 285 additions and 586 deletions.
12 changes: 6 additions & 6 deletions Src/Newtonsoft.Json/Bson/BsonReader.cs
Expand Up @@ -94,8 +94,8 @@ public ContainerContext(BsonType type)
[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>
Expand All @@ -106,8 +106,8 @@ public bool JsonNet35BinaryCompatibility
/// </value>
public bool ReadRootValueAsArray
{
get { return _readRootValueAsArray; }
set { _readRootValueAsArray = value; }
get => _readRootValueAsArray;
set => _readRootValueAsArray = value;
}

/// <summary>
Expand All @@ -116,8 +116,8 @@ public bool ReadRootValueAsArray
/// <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>
Expand Down
25 changes: 5 additions & 20 deletions Src/Newtonsoft.Json/Bson/BsonToken.cs
Expand Up @@ -45,10 +45,7 @@ public void Add(string name, BsonToken token)
token.Parent = this;
}

public override BsonType Type
{
get { return BsonType.Object; }
}
public override BsonType Type => BsonType.Object;

public IEnumerator<BsonProperty> GetEnumerator()
{
Expand All @@ -71,10 +68,7 @@ public void Add(BsonToken token)
token.Parent = this;
}

public override BsonType Type
{
get { return BsonType.Array; }
}
public override BsonType Type => BsonType.Array;

public IEnumerator<BsonToken> GetEnumerator()
{
Expand Down Expand Up @@ -111,15 +105,9 @@ public BsonValue(object value, BsonType type)
_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
Expand Down Expand Up @@ -167,10 +155,7 @@ public BsonRegex(string pattern, string options)
Options = new BsonString(options, false);
}

public override BsonType Type
{
get { return BsonType.Regex; }
}
public override BsonType Type => BsonType.Regex;
}

internal class BsonProperty
Expand Down
4 changes: 2 additions & 2 deletions Src/Newtonsoft.Json/Bson/BsonWriter.cs
Expand Up @@ -56,8 +56,8 @@ public class BsonWriter : JsonWriter
/// <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>
Expand Down
5 changes: 1 addition & 4 deletions Src/Newtonsoft.Json/Converters/CustomCreationConverter.cs
Expand Up @@ -96,9 +96,6 @@ public override bool CanConvert(Type objectType)
/// <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;
}
}
12 changes: 6 additions & 6 deletions Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs
Expand Up @@ -46,8 +46,8 @@ public class IsoDateTimeConverter : DateTimeConverterBase
/// <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>
Expand All @@ -56,8 +56,8 @@ public DateTimeStyles DateTimeStyles
/// <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>
Expand All @@ -66,8 +66,8 @@ public string DateTimeFormat
/// <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>
Expand Down
4 changes: 2 additions & 2 deletions Src/Newtonsoft.Json/JsonArrayAttribute.cs
Expand Up @@ -41,8 +41,8 @@ public sealed class JsonArrayAttribute : JsonContainerAttribute
/// <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>
Expand Down
20 changes: 10 additions & 10 deletions Src/Newtonsoft.Json/JsonContainerAttribute.cs
Expand Up @@ -77,7 +77,7 @@ public abstract class JsonContainerAttribute : Attribute
/// <value>The <see cref="Type"/> of the <see cref="NamingStrategy"/>.</value>
public Type NamingStrategyType
{
get { return _namingStrategyType; }
get => _namingStrategyType;
set
{
_namingStrategyType = value;
Expand All @@ -98,7 +98,7 @@ public Type NamingStrategyType
/// </example>
public object[] NamingStrategyParameters
{
get { return _namingStrategyParameters; }
get => _namingStrategyParameters;
set
{
_namingStrategyParameters = value;
Expand All @@ -125,8 +125,8 @@ public object[] NamingStrategyParameters
/// </value>
public bool IsReference
{
get { return _isReference ?? default(bool); }
set { _isReference = value; }
get => _isReference ?? default(bool);
set => _isReference = value;
}

/// <summary>
Expand All @@ -137,8 +137,8 @@ public bool IsReference
/// </value>
public bool ItemIsReference
{
get { return _itemIsReference ?? default(bool); }
set { _itemIsReference = value; }
get => _itemIsReference ?? default(bool);
set => _itemIsReference = value;
}

/// <summary>
Expand All @@ -147,8 +147,8 @@ public bool ItemIsReference
/// <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>
Expand All @@ -157,8 +157,8 @@ public ReferenceLoopHandling ItemReferenceLoopHandling
/// <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>
Expand Down
10 changes: 2 additions & 8 deletions Src/Newtonsoft.Json/JsonConverter.cs
Expand Up @@ -65,19 +65,13 @@ public abstract class JsonConverter
/// 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>
Expand Down
5 changes: 1 addition & 4 deletions Src/Newtonsoft.Json/JsonConverterAttribute.cs
Expand Up @@ -41,10 +41,7 @@ public sealed class JsonConverterAttribute : Attribute
/// 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"/>.
Expand Down
8 changes: 4 additions & 4 deletions Src/Newtonsoft.Json/JsonObjectAttribute.cs
Expand Up @@ -45,8 +45,8 @@ public sealed class JsonObjectAttribute : JsonContainerAttribute
/// <value>The member serialization.</value>
public MemberSerialization MemberSerialization
{
get { return _memberSerialization; }
set { _memberSerialization = value; }
get => _memberSerialization;
set => _memberSerialization = value;
}

/// <summary>
Expand All @@ -57,8 +57,8 @@ public MemberSerialization MemberSerialization
/// </value>
public Required ItemRequired
{
get { return _itemRequired ?? default(Required); }
set { _itemRequired = value; }
get => _itemRequired ?? default(Required);
set => _itemRequired = value;
}

/// <summary>
Expand Down
44 changes: 22 additions & 22 deletions Src/Newtonsoft.Json/JsonPropertyAttribute.cs
Expand Up @@ -92,8 +92,8 @@ public sealed class JsonPropertyAttribute : Attribute
/// <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>
Expand All @@ -102,8 +102,8 @@ public NullValueHandling NullValueHandling
/// <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>
Expand All @@ -112,8 +112,8 @@ public DefaultValueHandling DefaultValueHandling
/// <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>
Expand All @@ -122,8 +122,8 @@ public ReferenceLoopHandling ReferenceLoopHandling
/// <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>
Expand All @@ -132,8 +132,8 @@ public ObjectCreationHandling ObjectCreationHandling
/// <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>
Expand All @@ -142,8 +142,8 @@ public TypeNameHandling TypeNameHandling
/// <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>
Expand All @@ -152,8 +152,8 @@ public bool IsReference
/// <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>
Expand All @@ -164,8 +164,8 @@ public int Order
/// </value>
public Required Required
{
get { return _required ?? Required.Default; }
set { _required = value; }
get => _required ?? Required.Default;
set => _required = value;
}

/// <summary>
Expand All @@ -180,8 +180,8 @@ public Required Required
/// <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>
Expand All @@ -190,8 +190,8 @@ public ReferenceLoopHandling ItemReferenceLoopHandling
/// <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>
Expand All @@ -200,8 +200,8 @@ public TypeNameHandling ItemTypeNameHandling
/// <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>
Expand Down

0 comments on commit 9932155

Please sign in to comment.